Created
January 18, 2016 01:06
-
-
Save stormoz/88719fc61aab2e48320c to your computer and use it in GitHub Desktop.
inline css gulp task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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