简体   繁体   English

如何在Yeman中包含更少版本的bootstrap?

[英]How to include less version of bootstrap in yeoman?

I am using yeoman as a scaffolding tool for my app and using yeoman angular generator for the same. 我正在使用yeoman作为我的应用程序的脚手架工具,并使用yeoman角度生成器。

While scaffolding the app yeoman asks me whether I want to install SASS or not, but it doesn't give any option to include less and related grunt tasks for that. 在安装该应用程序时,yeoman询问我是否要安装SASS,但是它没有提供任何选择以包含较少的相关任务。

Please help me if I am missing something here. 如果我在这里缺少任何东西,请帮助我。

Here are the steps that I am following to scaffold my app. 这是我脚手架应用程序要遵循的步骤。

    npm install -g yo

    npm install -g generator-angular

    yo angular

Also tell me if it is possible to install the less related tasks and files separately after using the yeoman angular generator as a scaffolding tool. 还请告诉我,在将yeoman角度生成器用作脚手架工具之后,是否可以分别安装不太相关的任务和文件。

First installed the grunt-contrib-less module. 首先安装了grunt-contrib-less模块​​。

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

Copy the less folder from "bower_components/bootstrap" in the "app/styles" folder. “ app / styles”文件夹中的 bower_components / bootstrap”中复制less文件夹。 Than you need to update Gruntfile. 比您需要更新Gruntfile。

Add the following task: 添加以下任务:

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

You need to load the less task. 您需要加载较少的任务。

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

And as you can see this made a new your_bootstrap.css in your styles folder which will be linked in your index.html. 如您所见,这在您的样式文件夹中创建了一个新的your_bootstrap.css,该文件将链接到index.html中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM