【问题标题】:how to install grunt sass in angular js?如何在 Angular js 中安装 grunt sass?
【发布时间】:2015-10-24 10:52:15
【问题描述】:

我正在尝试在我的第一个 Angular 项目中使用 grunt。我正在尝试在我的项目中使用 sass。我遵循此链接的所有步骤 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$ 

在上面的链接中没有写出这种类型的错误或警告 你能告诉我如何解决这个错误

这是我的 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.

【问题讨论】:

  • 你安装了 Sass 吗?
  • 我不太了解..如何安装sass..我没有写sass安装教程

标签: angularjs angularjs-directive sass gruntjs angularjs-scope


【解决方案1】:

它明确地告诉你你做错了什么。

您需要在 PATH 中安装 Ruby 和 Sass 才能执行此任务。

你安装了 ruby​​ 吗?你有安装 Sass 吗?看起来您使用的是 macbook,因此您可能已经拥有 ruby​​。在您的终端中尝试gem install sass,看看会发生什么。

更多:http://sass-lang.com/install

【讨论】:

  • 尝试我会更新你..我有一个问题我正在研究 angular 而不是 ruby​​ 那么为什么它会给出 Ruby 和 Sass 的错误
  • 请检查我的更新仍然没有工作它给出了另一个错误
猜你喜欢
  • 1970-01-01
  • 2014-08-07
  • 2017-01-26
  • 1970-01-01
  • 2012-11-07
  • 2021-10-29
  • 2014-12-02
  • 1970-01-01
  • 2013-09-27
相关资源
最近更新 更多