【问题标题】:How to include less version of bootstrap in yeoman?如何在 yeoman 中包含较少版本的引导程序?
【发布时间】:2014-08-28 09:09:27
【问题描述】:

我使用 yeoman 作为我的应用程序的脚手架工具,并使用 yeoman 角度生成器。

在构建应用程序时,yeoman 会询问我是否要安装 SASS,但它没有提供任何选项来为此包含更少和相关的 grunt 任务。

如果我在这里遗漏了什么,请帮助我。

以下是我为我的应用搭建脚手架所遵循的步骤。

    npm install -g yo

    npm install -g generator-angular

    yo angular

另外告诉我,在使用 yeoman angular generator 作为脚手架工具后,是否可以单独安装相关性较低的任务和文件。

【问题讨论】:

标签: angularjs twitter-bootstrap web-applications yeoman


【解决方案1】:

首先安装了 grunt-contrib-less 模块。

npm install grunt-contrib-less --save-dev

"app/styles" 文件夹中的 "bower_components/bootstrap" 复制 less 文件夹。比你需要更新 Gruntfile。

添加以下任务:

...
less: {
    development: {
        options: {
            compress: true,
            optimization: 2
        },
        files: {
            "app/styles/your_bootstrap.css": "app/styles/less/bootstrap.less"
        }
    }
},
...

您需要加载较少的任务。

 grunt.loadNpmTasks('grunt-contrib-less');

正如您所见,这在您的样式文件夹中创建了一个新的 your_bootstrap.css,该文件夹将链接到您的 index.html 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多