Grunt需要很长时间来编译css文件,我不确定这是否正常但是常规指南针需要大约5秒钟.
所以问题是如果有任何方法可以加快Grunt的编译时间,或者只是坚持使用罗盘手表?
Running "compass:dist" (compass) task
?unchanged images/sprite-sf580a96666.png
overwrite stylesheets/app.css (3.263s)
unchanged images/sprite-sf580a96666.png
overwrite stylesheets/app_fr.css (3.289s)
Compilation took 11.116s
Running "watch" task
Completed in 13.974s at Wed Dec 18 2013 13:53:05 GMT-0500 (Eastern Standard Time- Waiting...
OK
>> File "scss\_core.scss" changed.
Run Code Online (Sandbox Code Playgroud)
Gruntfile.js:
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
watch: {
sass: {
files: ['scss/*.scss'],
tasks: ['compass:dist'],
options: {
spawn: false,
}
},
scripts: {
files: ['js/*.js'],
tasks: ['concat', 'uglify'],
options: {
spawn: false,
}
} …
Run Code Online (Sandbox Code Playgroud) performance watch gruntjs grunt-contrib-watch grunt-contrib-compass
我正在运行grunt-contrib-compass@0.6.0并且它因此错误而中止:
node_modules/grunt-contrib-compass/node_modules/tmp/lib/tmp.js:261
throw err;
^
Error: socket hang up
at createHangUpError (http.js:1476:15)
at Socket.socketCloseListener (http.js:1526:23)
at Socket.emit (events.js:95:17)
at TCP.close (net.js:465:12)
Run Code Online (Sandbox Code Playgroud)
我升级到grunt-contrib-compass@1.0.1,现在它不再退出,但它会产生以下错误/警告(当发生这种情况时它不再退出,即使它说致命)
Fatal error: socket hang up
Fatal error: socket hang up
Run Code Online (Sandbox Code Playgroud)
我只能假设更好的错误处理是同样的问题.是否有某种方法可以从抛出此错误的内容中获取更好的信息?这是我的Gruntfile的指南针部分
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/fonts',
importPath: '<%= yeoman.app %>/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: 'styles/fonts',
relativeAssets: false,
trace: true
},
dist: {},
server: {
options: {
debugInfo: true …
Run Code Online (Sandbox Code Playgroud) 我grunt-contrib-compass
用来将我的SCSS文件处理成一个CSS文件.基本上,罗盘考虑所有匹配的SCSS文件app/styles/**/*.scss
并将其编译成.tmp/styles/main.css
.
我想将此行为分为:
app/styles/specific/**/*.scss
至 .tmp/styles/specific.css
app/styles/**/*.scss
到 .tmp/styles/main.css
(忽略specific
)但是,我不知道如何配置关于我的配置文件的grunt非常简单:
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/bower_components',
relativeAssets: true
}
Run Code Online (Sandbox Code Playgroud)
我无法找出任何解决方案,特别是因为罗盘文档说明cssDir
并且sassDir
只允许字符串作为参数.这是否必须在其他任务中完成?
我正在尝试运行 grunt-contrib-compass,但遇到此错误:
Warning: Couldn't find the `compass` binary. Make sure it's installed and in your $PATH Use --force to continue.
Run Code Online (Sandbox Code Playgroud)
我跑了:
sudo gem install compass
sudo gem install sass
sudo gem update --system
当我做 gem list 时,我得到:
compass (1.0.1)
rails (4.1.6)
sass (3.4.5, 3.3.4)
Run Code Online (Sandbox Code Playgroud)
红宝石:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
Run Code Online (Sandbox Code Playgroud)
关于如何让 grunt-contrib-compass 工作的任何建议或解决方案?
我正在我的网站上工作,我想使用Susy和Compass.我也在使用Grunt.当我运行我的grunt任务时,我收到此错误:
Denniss-MacBook-Pro:portfolio dennis$ grunt --trace
Running "compass:dev" (compass) task
Gem::LoadError on line ["1990"] of /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb: Unable to activate susy-2.1.1, because sass-3.2.17 conflicts with sass (~> 3.3.0)
Run with --trace to see the full backtrace
Warning: ? Use --force to continue.
Aborted due to warnings.
Run Code Online (Sandbox Code Playgroud)
这是我的Grunt文件:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
options: {
livereload: true
},
css: {
files: ['_sass/*.{scss,sass}'],
tasks: ['compass:dev']
},
js: {
files: ['js/*.js'],
tasks: ['uglify']
}
},
compass: {
options: {
require: 'susy' …
Run Code Online (Sandbox Code Playgroud) 使用时出现以下错误grunt compass
:
"您必须从项目目录中编译单个样式表."
我用3种不同的方式尝试了它.更多下面.
我的文件夹结构:
test \
Gruntfile.js
package.json
\ node_modules \
\ _src \ (this is the root folder of my Jekyll site)
\ config.rb
\ index.html
\ static/
\ _sass \
\ css \
\ images \
\ js \
Run Code Online (Sandbox Code Playgroud)
一切正常,无需使用grunt
和使用/_src/config.rb
:
#project_path = "_src/"
http_path = "/"
css_dir = "css"
css_path = "static/" + css_dir
sass_dir = "_sass"
sass_path = "static/" + sass_dir
images_dir = "images"
images_path = "static/" …
Run Code Online (Sandbox Code Playgroud)