gulp-useref implementation for Wok
npm install @wok-cli/plugin-userefThis plugin implements gulp-useref.
| Hook types | Production only | Purpose |
| ---------- | --------------- | ------------------- |
| lazypipe | yes | assets optimization |
- gulp-useref for Wok
- Installation
- Parameters
- Usage
- Custom Blocks
This plugin requires @wok-cli/core.
```
npm i @wok-cli/core @wok-cli/plugin-useref --save-dev
Configuration path: useref.
| parameter | type | default | note |
| ------------ | ----------------- | ------- | ------------------------------ |
| sourcemaps | boolean
string | | write sourcemaps(1) |
1. _Defaults to the value of env.sourcemaps._
All other parameters will be used as gulp-useref configuration options.
Note that the searchPath and base options are enhanced with support for environment templates.
The most common usage scenario of this plugin is with @wok-cli/task-views:
`js
const $ = require('@wok-cli/core');
const views = require('@wok-cli/task-views');
const useref = require('@wok-cli/plugin-useref');
const viewsTask = $.task(views, {
src: ['src/*/.html'],
dest: 'public',
});
viewsTask.tap('post', 'useref', useref);
exports.views = viewsTask;
`
Refer to gulp-useref documentation for usage details.
gulp-useref allows you to do custom processing via custom blocks.
This plugin implements by default a custom replace block, which can be used to replace a script tag src attribute without processing the source file.
Example input:
`html`
Output with --production:
`html``