den*_*hik 10 gruntjs compass-sass
所以我有以下情况.当我从CLI使用指南针时它只是工作并完全符合要求.我正在compass compile从文件所在的同一文件夹config.rb(在styles文件夹中)运行.它还包含sass和css目录.这是我的config.rb档案:
project_path = '.'
css_dir = "css"
sass_dir = "sass"
images_dir = "../../data/images"
javascripts_dir = "../scripts"
output_style = :compressed
environment = :development
relative_assets = true
Run Code Online (Sandbox Code Playgroud)
当我尝试使用grunt此时,我使用以下配置Gruntfile.js:
compass: {
    compile: {
        options: {
            basePath: 'app/src/styles',
            config: 'app/src/styles/config.rb'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)
该app文件夹Gruntfile.js位于同一级别.当我跑步时,grunt compass我看到以下输出:
Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Done, without errors.
Run Code Online (Sandbox Code Playgroud)
如果我尝试直接指定所有选项,如:
compass: {
    compile: {
        options: {
            basePath: 'app/src/styles',
            sassDir: 'app/src/styles/sass',
            cssDir: 'app/src/styles/css',
            imagesDir: 'app/data/images'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)
它完成了这项工作,但.sass-cache文件夹是在级别创建的Gruntfile.js.所以我猜basePath配置选项存在一些问题.
难道我做错了什么?
编辑:
唯一的方法,我设法使其工作,按照预期将config.rb文件移动到级别Gruntfile.js,并在其中指定以下选项:
project_path = 'app/src/styles'
css_dir = "css"
sass_dir = "sass"
images_dir = "../../data/images"
javascripts_dir = "../scripts"
output_style = :compressed
environment = :development
relative_assets = true
Run Code Online (Sandbox Code Playgroud)
我还从'Gruntfile.js`中删除了所有关于此任务的选项.还不确定,这里发生了什么.
尝试不要在 Grunt 配置中设置 basePath,即:
compass: {
   compile: {
     options: {
        basePath: 'app/src/styles',
        config: 'app/src/styles/config.rb'
    }
  }
}
Run Code Online (Sandbox Code Playgroud)
变成:
compass: {
       compile: {
         options: {
            config: 'app/src/styles/config.rb'
        }
      }
    }
Run Code Online (Sandbox Code Playgroud)
并且还可以Grunt Compass使用 --verbose 开关 ( grunt compass --verbose) 运行您的程序以查看 grunt 正在尝试处理哪些文件。
请注意,添加到 Grunt 文件中选项的任何设置都将覆盖(或扩展)config.rb 文件中的设置。
查看此页面:https://github.com/gruntjs/grunt-contrib-compass查看有关 grunt-contrib-compass 的更多信息。他们有关于所有可能的选择的信息。
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           7790 次  |  
        
|   最近记录:  |