Skip to content

Instantly share code, notes, and snippets.

@LoyEgor
Created January 8, 2018 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LoyEgor/f4efd8ea5174b035cd5fcc3737d0ef2c to your computer and use it in GitHub Desktop.
Save LoyEgor/f4efd8ea5174b035cd5fcc3737d0ef2c to your computer and use it in GitHub Desktop.
inject css inline
//install
//npm i gulp-inject group-array@0.3.1
var inject = require('gulp-inject');
// inject cssinlining
gulp.task('inject:cssinlining', function() {
return gulp.src('./app/*.html')
.pipe(inject(gulp.src('app/css/header.min.css'), {
starttag: '<!-- inject:cssinlining -->',
transform: function(filePath, file) {
return '<style>' + file.contents.toString('utf8') + '</style>'
}
}))
.pipe(gulp.dest('./dist'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment