Answer the question
In order to leave comments, you need to log in
How to fix gulp config?
You need to make a replacement in the final CSS according to the template that is in the settings-default.json file, I write this config:
gulp.task( 'admin.css', () => {
return gulp.src( [ 'framework/assets/scss/admin.scss', 'framework/blocks/*.scss' ] )
.pipe( plumber() )
.pipe( sassglob() )
.pipe( sass() )
.pipe( concat( 'admin.min.css' ) )
.pipe( cssnano() )
.pipe( replace( '/здесь регулярка/', () => {
fs.readFile( 'settings-default.json', 'utf8', ( err, data ) => {
if ( err ) {
throw err;
}
//здесь берём данные из файла и делаем замену
console.log( data ); //почему консоль лог срабатывает 4 раза?
} );
return //возвращаем результат для каждой замены;
} ) )
.pipe( gulp.dest( 'framework/assets/css' ) );
} );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question