Skip to content

Build without concat CSS files #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CristianMR opened this issue Dec 6, 2014 · 1 comment
Closed

Build without concat CSS files #158

CristianMR opened this issue Dec 6, 2014 · 1 comment

Comments

@CristianMR
Copy link

Hey guys. I don't know so much about gulp. I tried to modify gulp/build.js to disable CSS concat functionality, but I could not figure out how to do it. If you asked why I want to do this, I have a big proyect with some CSS files having style conflicts, to solve the problem I inject only the CSS that I want to use in the moment (depending of the view). To do so, I need to copy CSS files without change the routes.

Maybe it have something to do with that route ''styles/app.js" in the head of index.html.

<!-- build:css({.tmp,src}) styles/app.css -->
<!-- inject:css -->
<link rel="stylesheet" href="app/index.css">
<link rel="stylesheet" href="app/login/login.css">
...
...
...
<!-- endinject -->
<!-- endbuild -->
@CristianMR
Copy link
Author

I created a mini gulp module to solve this problem. But, I think that can be better, so I don't uploaded the module yet. Basically I have app.js file, and constants with array of files to load. Something like this:

angular.module('app', [ngCssInjector])
.constant('mainViewCss', ['path/to/style1.css', 'path/to/style2.css', 
'path/to/style3.css'])
.constant('loginViewCss', ['path/to/style2.css', 'path/to/style4.css', 
'path/to/style5.css']).etc()

Then, cause I never injected that files on index.html, I take the files from the constant values in app.js and then just uglify and copy all files.

gulp.task('copy-extra-files', function(){
  return gulp.src('src/app/app.js')
    .pipe(ngContantValues())
    .pipe(minifyCSS())
    .pipe(gulp.dest(relativeDir));
});

The project is responsible for injecting the files is in https://github.com/CristianMR/ngcssinjector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants