gulp-htmlbuild icon indicating copy to clipboard operation
gulp-htmlbuild copied to clipboard

block of dynamic Less gets injected as link stylesheet rather than stylesheet/less

Open geetee24 opened this issue 8 years ago • 4 comments

I have

<link rel="stylesheet/less" type="text/less" href="styles/nonCacheable/sprinkler.less" />

it should create

but it creates which breaks the dynamic less.js

Can you help?

geetee24 avatar Oct 28 '17 04:10 geetee24

Are you using htmlbuild.preprocess.css? That probably won't work for you. You're going to need to write your own implementation for less.

Read this code to understand how these functions work so you can write your own less-specific version of it: https://github.com/Janpot/gulp-htmlbuild/blob/master/lib/preprocess/css.js#L19

Janpot avatar Oct 28 '17 12:10 Janpot

how do i incorporate my new blabla.js preporocessor into your code base?

geetee24 avatar Dec 05 '17 05:12 geetee24

The same way as in the readme example:

const blablaPreprocessor = require('./blabla.js');

gulp.task('build', function () {
  gulp.src(['./index.html'])
    .pipe(htmlbuild({
      // build blabla with blablaPreprocessor
      blabla: blablaPreprocessor(function (block) {
        
        // read paths from the [block] stream and build them
        // ...
        
        // then write the build result path to it
        block.write('buildresult.blabla');
        block.end();
        
      })
    }))
    .pipe(gulp.dest('./build'));
});

Janpot avatar Dec 05 '17 08:12 Janpot

awesome. thanks it worked :)

geetee24 avatar Dec 05 '17 19:12 geetee24