Grunt-injector ignores css file due to dependency

I am using grunt-injector in new projects. It is configured to add all the bowler dependencies to the index.html file.

I have ionic ones in my dependencies and I use it only for javascript file and not for css. Therefore, I would like this crunch injector not to add an ionic css file to my project.

here is my configuration:

injector: { options: { addRootSlash: false, ignorePath: 'app/', bowerPrefix: 'bower', }, bowerDependencies: { files: { 'app/index.html': ['bower.json'], } } 

I could do this by changing ionic / bower.json:

 "main": [ //"css/ionic.css", "fonts/*", "js/ionic.js", "js/ionic-angular.js" ] 

But of course I would rather not do it

+8
javascript gruntjs
source share
1 answer

It may help, but I found out that the gulp-injector simply compiles all CSS files between <!-- bower:css --> ... <!-- endbower -->

Another task is to read my bower file and edit index.html, this is wiredep plugin .

So, if you, like me, used already prepared scaffolding, look for this task (here gulp):

 gulp.task('wiredep', function() { log('Wiring the bower dependencies into the html'); var wiredep = require('wiredep').stream; var index = paths.client + 'index.html'; return gulp.src(index) .pipe(wiredep({ directory: './bower_components/', bowerJson: require('./bower.json'), exclude: ['bower_components/foundation/css/foundation.css', 'bower_components/toastr/toastr.css'], ignorePath: '../..' // bower files will be relative to the root })) .pipe(gulp.dest(paths.client)); }); 

By defining excluse, your power will force it to ignore such files without editing your packages in bower: D

0
source share

All Articles