Skip to content

Instantly share code, notes, and snippets.

@stormoz
Created January 18, 2016 01:06
Show Gist options
  • Save stormoz/88719fc61aab2e48320c to your computer and use it in GitHub Desktop.
Save stormoz/88719fc61aab2e48320c to your computer and use it in GitHub Desktop.
inline css gulp task
gulp.task('inline', function () {
console.log('Inline css');
return gulp.src(config.build + "index.html")
.pipe(replace(/\<link .*?href=["']css\/styles\.css["'].*?[\/]{0,1}\>/, function(s) {
var style = fs.readFileSync(config.build + "css/styles.css", 'utf8');
return '<style>\n' + style + '\n</style>';
}))
.pipe(gulp.dest(config.buildDir));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment