Answer the question
In order to leave comments, you need to log in
Which gulp plugin can only embed inline styles from a specific file into a page?
Which gulp plugin can only embed inline styles from a specific file into an html page?
A few that have been tried embed all the styles included on the page.
Ideally, you need a plugin with a minimum of settings that takes the specified css file and embeds its styles into the header of the specified page.
Answer the question
In order to leave comments, you need to log in
replace = require('gulp-replace')
var fs = require('fs');
var pls = '<link rel="stylesheet" href="wp-content/themes/dist/css/vendor.css">';
gulp.task('csspush', function(){
return gulp.src('wp-content/themes/dist/header.php')
.pipe(replace(pls,function(s) {
var style = fs.readFileSync('./wp-content/themes/dist/css/vendor.css', 'utf8');
return '<style>\n' + style + '\n</style>';
}))
.pipe(gulp.dest('wp-content/themes/dist/'));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question