如何在 angular js 中安装 grunt sass?
how to install grunt sass in angular js?
我正在尝试在我的第一个 angular 项目中使用 g运行t。我正在尝试在我的项目中使用 sass。我遵循此 [=33] 的所有步骤=]
http://blog.meredithunderell.com/2014/07/24/setting-up-twitter-bootstrap-sass-with-grunt-in-an-angularjs-project/
我正在尝试使用 sass 将 .sass 文件转换为 css 文件。但是当我 运行 我的项目时,我收到错误
MacBook-Pro:test_saas naveenkumar$ grunt sass
Running "sass:dist" (sass) task
Warning:
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
Use --force to continue.
Aborted due to warnings.
MacBook-Pro:test_saas naveenkumar$
上面link没有写这种类型的错误或警告
你能告诉我如何解决这个错误吗
这是我的 gruntfile.js
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
project: {
app: ['app'],
assets: ['<%= project.app %>/assets'],
css: ['<%= project.assets %>/sass/style.scss']
},sass: {
dist:{
files:{
'app/assets/css/style.css':'app/assets/css/style.scss'
}
}
//dev: {
// options: {
// style: 'expanded'},
// files: {
// '<%= project.assets %>/css/style.css':'<%= project.css %>'
// }
//}
},watch: {
sass: {
files: '<%= project.assets %>/sass/{,*/}*.{scss,sass}',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [
'watch'
]);
};
更新
安装后 sass 出现此错误
MacBook-Pro:test_saas naveenkumar$ grunt sass
Running "sass:dist" (sass) task
Errno::ENOENT: No such file or directory - undefined
Use --trace for backtrace.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
它明确地告诉你你做错了什么。
You need to have Ruby and Sass installed and in your PATH for this task to work.
你有ruby安装吗?你有安装 Sass 吗?看起来您使用的是 macbook,因此您可能已经 ruby。在您的终端中尝试 gem install sass
,看看会发生什么。
我正在尝试在我的第一个 angular 项目中使用 g运行t。我正在尝试在我的项目中使用 sass。我遵循此 [=33] 的所有步骤=] http://blog.meredithunderell.com/2014/07/24/setting-up-twitter-bootstrap-sass-with-grunt-in-an-angularjs-project/
我正在尝试使用 sass 将 .sass 文件转换为 css 文件。但是当我 运行 我的项目时,我收到错误
MacBook-Pro:test_saas naveenkumar$ grunt sass
Running "sass:dist" (sass) task
Warning:
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
Use --force to continue.
Aborted due to warnings.
MacBook-Pro:test_saas naveenkumar$
上面link没有写这种类型的错误或警告 你能告诉我如何解决这个错误吗
这是我的 gruntfile.js
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
project: {
app: ['app'],
assets: ['<%= project.app %>/assets'],
css: ['<%= project.assets %>/sass/style.scss']
},sass: {
dist:{
files:{
'app/assets/css/style.css':'app/assets/css/style.scss'
}
}
//dev: {
// options: {
// style: 'expanded'},
// files: {
// '<%= project.assets %>/css/style.css':'<%= project.css %>'
// }
//}
},watch: {
sass: {
files: '<%= project.assets %>/sass/{,*/}*.{scss,sass}',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [
'watch'
]);
};
更新
安装后 sass 出现此错误
MacBook-Pro:test_saas naveenkumar$ grunt sass
Running "sass:dist" (sass) task
Errno::ENOENT: No such file or directory - undefined
Use --trace for backtrace.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
它明确地告诉你你做错了什么。
You need to have Ruby and Sass installed and in your PATH for this task to work.
你有ruby安装吗?你有安装 Sass 吗?看起来您使用的是 macbook,因此您可能已经 ruby。在您的终端中尝试 gem install sass
,看看会发生什么。