在grunt-cont肋骨-触控笔中有一个导入选项:
导入
类型:数组
将给定的手写笔包导入到每个已编译的.styl文件中,就好像您编写了“@ Import”.在所有的文件中。
options: {
compress: false,
use: [ require('kouto-swiss') ],
import: [ 'kouto-swiss' ]
},我怎样才能在无牢骚中对女同性恋做同样的事呢?
谢谢
发布于 2015-02-03 18:52:05
从第2版开始,您可以不那么容易地创建插件。感谢实现预处理插件,您也可以创建预处理插件。
预处理插件使您能够在处理之前注入更少的代码:
LesshatProcessor.prototype = {
process : function (src, extra) {
var injected = '@import "' + path.resolve(__dirname, '../') + '/node_modules/lesshat/build/lesshat.less";\n';
var ignored = extra.imports.contentsIgnoredChars;
var fileInfo = extra.fileInfo;
ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0;
ignored[fileInfo.filename] += injected.length;
return injected + src;
}
};我已经创建了一个Lesshat插件:https://github.com/bassjobsen/less-plugin-lesshat。在通过运行npm install less-plugin-lesshat安装这个插件之后,您就可以运行:lessc file.less --lesshat。
您也可以将此插件与无格罗特(Grunt)结合使用:
grunt.initConfig({
less: {
options: {
plugins: [
new (require('less-plugin-lesshat'))()
]
},
files: {'css/test.css' : 'less/test.less'}
}
)};请注意,您应该安装最新版本的Less cont肋骨- Less,直到拥有了更少的更新版本号 (以及grunt-cont罗比-更少地使用该版本)。
现在使用插件:
npm install grunt-contrib-lessnode_modules/grunt-contrib-less/node_modules/lessnpm install ./less.jshttps://stackoverflow.com/questions/28243063
复制相似问题