art-template loader for webpack.
Install
npm install art-template |
Usage
By default every local <img src="image.png">
is required (require('./image.png')
). You may need to specify loaders for images in your configuration (recommended file-loader
or url-loader
).
You can specify which attribute combination should be processed by this loader via the query parameter htmlResourceRules
. (Default: htmlResourceRules=[/\bsrc="([^"]*)"/]
)
To completely disable tag-attribute processing (for instance, if you’re handling image loading on the client side) you can pass in htmlResourceRules=false
.
Examples
module.exports = { |
<% include('./header.art') %> |
‘Root-relative’ URLs
For urls that start with a /
, the default behavior is to not translate them.
If a htmlResourceRoot
query parameter is set, however, it will be prepended to the url
and then translated.
With the same configuration as above:
<!-- file.art --> |
require("html-loader!./file.art"); |
require("html-loader?htmlResourceRoot=.!./file.art"); |
Filter
Add filter:
var runtime = require('art-template/lib/runtime'); |
Use filter:
{{time | dateFormat 'yyyy-MM-dd hh:mm:ss'}} |
Debug
Support SourceMap
:
webpack --debug |
Options
You can pass art-template options.
Using standard webpack loader options.