jacksontian / loader Goto Github PK
View Code? Open in Web Editor NEWAssets loader.
License: Other
Assets loader.
License: Other
var Loader = function (js, css) {
if (!(this instanceof Loader)) {
return new Loader(js, css);
}
var target = {};
target[path.extname(js)] = js;
target[path.extname(css)] = css;
这里面的 path.extname
现在不接受 undefined
我尝试过
Loader('http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css')
.css('/public/stylesheets/style.css')
.done(assets, config.site_static_host, config.mini_assets)
script(type='text/javascript').
Loader('http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css')
.css('/public/stylesheets/style.css')
.done(assets, config.site_static_host, config.mini_assets);
都不行……
使用loader 引入less文件有bug。当less文件中包含导入@import XXX 此类代码时候,loader工作不了。
0.1.4 版本可以这么用, 2.0.0 版本不行,我用的 express,文档上也没有说明,请问到底怎么用啊?
less文档:
less.render('.class { width: (1 + 1) }',
{
paths: ['.', './lib'], // Specify search paths for @import directives
filename: 'style.less', // Specify a filename, for better error messages
compress: true // Minify CSS output
},
function (e, output) {
console.log(output.css);
});
lib/loader:
// 调用less将源文件内容翻译为CSS
less.render(content, function (err, css) {});
可以在此处用第二个参数指定路径信息
请问一下朴大,在Loader加载less文件时,如果less文件包含@import标签,在builder的时候会报异常,这个问题该如何解决?
最近在翻新 nodeclub,对于 loader 有以下几点改进建议
done()
即可,而非 .done(assets, config.site_static_host, config.mini_assets)
因为这三个参数基本在每个调用 loader 的地方都是一样。
这三个参数都应在初始化 loader 时有个默认值,需要覆盖时再传参。
难点:需要考察对需要 build 的目录整个做 md5 的效率如何。
以上你的意向如何?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.