Skip to content

Instantly share code, notes, and snippets.

@LoyEgor
Created January 8, 2018 14:31
Show Gist options
  • 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 [email protected]
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