@ad2302/less-bundle-promise 中文文档教程

发布于 3年前 浏览 7 项目主页 更新于 3年前

Less Bundle Promise (less-bundle-promise)

将所有 LESS 文件捆绑到一个文件中。 对于使用自己的 LESS 文件的多个组件的大型项目很有用。

Usage

var bundle = require('less-bundle-promise');

bundle({
    src: 'main.less'
}).then(output =>{
  // do something with output less
}).catch(error => {
  console.log('Error', error);
});

// Or write to a file
bundle({
    src: 'main.less',
    dest: 'bundle.less',
    writeFile: true
}).then(output =>{
  // do something with output less
}).catch(error => {
  console.log('Error', error);
});

A `bundle.less` file will be generated with all less output

Options

interface IConfig {
    /**
     * The index.html file used to find all the *.less files and 
     * build them in order. Starts at the <!-- less-bundle-start -->
     * comment and ends at <!-- less-bundle-end -->
     */
    src: string;

    /**
     * An array of destination file paths. Once the framework 
     * is built, it will be output to these paths.
     */
    dest: Array<string>;

    /**
    * Boolean flag to indicate that if we want the compiled css into dest file or not 
    */
    writeFile?: boolean;

    /**
     * The version number used in conjunction with the license.
     */
    version?: string;

    /**
     * The path to the license file to be added to the build as a
     * comment. If a version is specified, the v.0.0.0 in the 
     * license will be replaced with the version.
     */
    license?: string;
}

Less Bundle Promise (less-bundle-promise)

Bundle all of your LESS files into a single file. Useful for large projects with multiple components utilizing their own LESS files.

Usage

var bundle = require('less-bundle-promise');

bundle({
    src: 'main.less'
}).then(output =>{
  // do something with output less
}).catch(error => {
  console.log('Error', error);
});

// Or write to a file
bundle({
    src: 'main.less',
    dest: 'bundle.less',
    writeFile: true
}).then(output =>{
  // do something with output less
}).catch(error => {
  console.log('Error', error);
});

A `bundle.less` file will be generated with all less output

Options

interface IConfig {
    /**
     * The index.html file used to find all the *.less files and 
     * build them in order. Starts at the <!-- less-bundle-start -->
     * comment and ends at <!-- less-bundle-end -->
     */
    src: string;

    /**
     * An array of destination file paths. Once the framework 
     * is built, it will be output to these paths.
     */
    dest: Array<string>;

    /**
    * Boolean flag to indicate that if we want the compiled css into dest file or not 
    */
    writeFile?: boolean;

    /**
     * The version number used in conjunction with the license.
     */
    version?: string;

    /**
     * The path to the license file to be added to the build as a
     * comment. If a version is specified, the v.0.0.0 in the 
     * license will be replaced with the version.
     */
    license?: string;
}
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文