webpack-component-loader
A webpack loader to componentify CSS/JS/HTML without framework
Install
$npm install webpack-component-loader
Test
$npm test
Usage
webpack
;// or create the injector, extractor or addScopeAttr by yourself { // extract the including component path from the plain text of template} { // inject the url of assets to template} { // add data-s-[hash] to tags in template for scope css, and must return Promise type return ;} moduleexports = entry: entryA: './test/fixture/entryA.js' entryB: './test/fixture/entryB.js' output: path: path filename : 'js/[name].js' chunkFilename: 'js/[name].chunk.js' module: rules: test : /\.tpl?$/ exclude: // use: loader: 'webpack-component-loader' options: isCodeSplit: false extractor injector addScopeAttr ext: '.tpl' srcPath : path builtTemplatePath : path test: /\.css$/ exclude: // enforce: "post" use: ExtractTextPlugin plugins: filename: "css/[name].css" // allChunks: true name: "commons" filename: "js/commons.js"
Ecosystem
Name | Status | Description |
---|---|---|
component-smarty-parser | Parser to extract and inject smarty template | |
component-pug-parser | Parser to extract and inject pug template |