angularjs - Webpack Config for Static Pug/HTML Pages -
i'm transitioning site use webpack, , need little configuration. have few pages written in pug/jade large , infrequently accessed (think terms of service or privacy policy). of .jade
files angular templates, inlined in components , works well. these few files, however, webpack compile static html files served separately rest of app. however, would still file names include hash.
the basic idea i've come this:
in routes.ts
:
$routeprovider.when('/_tos', templateurl: require('./resources/terms-of-service.jade'))
in webpack.config.js
's list of loaders:
{ test: /resources.*\.jade$/, loaders: ['file?name=[name].[hash].html', 'pug-html'] }
i've tried various combinations of pug-loader, pug-html-loader (with , without ?exports=false
option), html-loader, extract-loader, extract-text-webpack-plugin, , file-loader, try has artifacts in resulting .html
file. e.g. might start module.exports =
, or might put \"
everywhere in file should have "
.
can help?
gah! figured out. fundamentally misunderstood way list of loader works. assumed first loader in array matched used, no, loaders match used. (though i'm still fuzzy on details.) here working configuration, resources
path "resources" directory:
loaders: [ { test: /\.jade$/, include: [resources], loaders: ['file?name=[name].[hash].html', 'pug-html?exports=false'] }, { test: /\.jade$/, exclude: [resources], loaders: ['pug-html?doctype=html'] } ]
Comments
Post a Comment