Skip to content

switer/comps-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

comps-loader

npm version

Comps template loader for webpack.

Usage

npm install comps-loader --save-dev

Using with webpack:

loaders:[{
    test: /\.tpl$/,
    loader: 'comps-loader'
}]

Set component path resolver:

var compsLoader = require('comps-loader')
compsLoader.resolve(function (name) {
    return path.join('/path/to/components', name, name, '.tpl')
})

API

use(comps)

  • Param: comps<Function> Comps module.

Custom Comps module instance, if has more than one Comps instance, default require("comps").

resolve(resolver)

  • Param: resolver<Function>

Define resolve method use to get component's file path by name, which receiving a "name" argument.

Plugins

WebpackQueryPlugin(webpack, seperator[, test, loader])

Syntax sugar for webpack-loader with query. It replace require(./a.tpl??pagelet=b) with require(comps?pagelet=b!./a.tpl)

?? is the seperator<String> param, and the test<RegExp> param is using to filtrate unmatch files. loader for set custom loader, default "comps-loader"

About

Comps template loader for webpack.

Resources

License

Stars

Watchers

Forks

Packages

No packages published