edpx-css-loader
v0.1.0
Published
css-loader
Downloads
3
Readme
CSS Module Loader
edp-webserver-config.js 配置
- 在文件顶部require css-loader包
var cssLoader = require('edpx-css-loader/util/cssloader-handler');
- 增加location选择
exports.getLocations = function () {
return [
{
location: /\/$/,
handler: home('index.html')
},
{
location: /\.css\.js($|\?)/,
handler: [
cssLoader({})
]
},
{
location: /^.*$/,
handler: [
file(),
proxyNoneExists()
]
}
];
};
- 重启edp webserver服务,即可使用
edp-build-config.js 配置
- 在文件顶部引入CssLoaderProcessor
var CssLoaderProcessor = require('edpx-css-loader/util/CssLoaderProcessor');
- 增加processor
exports.getProcessors = function () {
var lessProcessor = new LessCompiler();
var cssProcessor = new CssCompressor();
var cssLoaderProcessor = new CssLoaderProcessor({
files: ['*.css'],
processUrl: function (url) {return 'xx_' + url;}
});
var moduleProcessor = new ModuleCompiler();
var jsProcessor = new JsCompressor();
var pathMapperProcessor = new PathMapper();
var addCopyright = new AddCopyright();
return {
'default': [
lessProcessor, cssProcessor, cssLoaderProcessor, moduleProcessor, pathMapperProcessor
],
'release': [
lessProcessor, cssProcessor, moduleProcessor,
jsProcessor, pathMapperProcessor, addCopyright
]
};
};