如何在自耕农中包含较少版本的bootstrap?

时间:2014-08-28 09:09:28

标签: angularjs twitter-bootstrap web-applications yeoman

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

虽然脚手架应用程序yeoman问我是否要安装SASS,但它没有给出任何选项来包含更少和相关的grunt任务。

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

以下是我跟踪我的应用程序的步骤。

    npm install -g yo

    npm install -g generator-angular

    yo angular

另外告诉我,在使用yeoman角度生成器作为脚手架工具后,是否可以单独安装不太相关的任务和文件。

1 个答案:

答案 0 :(得分:1)

First installed the grunt-contrib-less module.

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

Copy the less folder from "bower_components/bootstrap" in the "app/styles" folder. Than you need to update 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.