我已经设置了一个新项目来使用Gulp和Sass测试Foundation 6,但它似乎根本没有编译.还有另一篇文章接近这个主题,但我个人认为接受的答案不是正确的解决方案 - 因为它包含了所有组件,实际上与Zurb建议的相反(参见此问题:https://github.com/zurb/foundation-sites/issues/7537).无论如何 ......
我从凉亭安装了Foundation 6.1.1,并添加了我的gulp-sass函数的路径,gulpfile.js如下所示:
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('scss/theme.scss')
.pipe(sass({ includePaths : ['bower_components/foundation-sites/scss'], outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(gulp.dest('css/'))
});
Run Code Online (Sandbox Code Playgroud)
我的theme.scss情况如下:
//vendor file
@import '../bower_components/foundation-sites/scss/settings/settings';
@import '../bower_components/foundation-sites/scss/foundation';
body{
background: red;
}
Run Code Online (Sandbox Code Playgroud)
编译我的scss时我没有错误,但输出theme.css看起来像这样:
/**
* Foundation for Sites by ZURB
* Version 6.1.1
* foundation.zurb.com
* Licensed under MIT Open Source
*/
body {
background: red;
}
Run Code Online (Sandbox Code Playgroud)
所以看起来它正在击中文件,因为评论输出但它没有编译任何Sass导入foundation.scss.
我想从最后一个figure元素中删除背景:
@media (min-width: 50em) {
#mission #press figure {
padding-left: 0;
background: url('/assets/img/splash-green.png?1345829368') no-repeat 50% bottom;
}
#mission #press figure:last-child {
background: none;
}
}
Run Code Online (Sandbox Code Playgroud)
背景仍然显示出来.我错误定位了吗?
我正在尝试创建动态值,但到目前为止失败了.创建的像素值似乎失去了在计算中使用的能力.
$numericValue: 30;
$pixelValue: $numericValue+px;
// also tried $pixelValue: #{$numericValue}px;
$calc: $pixelValue * 2;
// also tried $calc: unquote($pixelValue) * 2;
Run Code Online (Sandbox Code Playgroud)
这会引发错误
语法错误:未定义的操作:"30px乘以2"
我在windows 8.1 pro中安装ruby
ruby 2.1.3p242 (2014-09-19 revision 47630) [x64-mingw32]
Run Code Online (Sandbox Code Playgroud)
和宝石版
2.2.2
Run Code Online (Sandbox Code Playgroud)
在执行gem安装时抛出此错误:
ERROR: Loading command: install (ArgumentError)
unknown encoding name - CP720
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Run Code Online (Sandbox Code Playgroud) 有一种方法来设置max-height的%,但这里的任何方式来设置DIV最大高度,所以这将是比100像素窗口高度较小,只有CSS?
它不能是固定的布局,用户必须能够垂直滚动页面,但DIV应始终调整大小window height - 100px.这可能,或者我必须使用JS吗?
在测试一些新的布局时,我发现自己一度写作
.test1 {width: calc(50% + 0);}
Run Code Online (Sandbox Code Playgroud)
令我惊讶的是,它没有用.
在验证我在任何地方都没有拼写错误后,我被迫得出结论,浏览器拒绝了这个错误.然后我想也许这是我测试的浏览器中的一个缺陷,但另一个表现相同!
那么这个表达的错误是什么呢?错误在哪里?
p {border:2px solid green}
.test1 {width:calc(50% + 0);} /* wrong! */
.test2 {width:calc(50%);} /* OK */
.test3 {width:calc(50% + 0px);} /* also OK */Run Code Online (Sandbox Code Playgroud)
<p class="test1">test 1</p>
<p class="test2">test 2</p>
<p class="test3">test 3</p>Run Code Online (Sandbox Code Playgroud)
(顺便说一句,让我向你保证,我无意在生产代码中使用它;这只是测试中出现的内容.)
当我尝试将变量用于字体速记属性的font-size和line-height部分时,Sass执行除法而不是用斜杠分隔这两个值.
@mixin test($fontsize, $lineheight) { font: $fontsize/$lineheight sans-serif; }
#my-font { @include test(14px, 20px); }
Run Code Online (Sandbox Code Playgroud)
目前输出:
#my-font { font: 0.7 sans-serif; }
Run Code Online (Sandbox Code Playgroud)
我怎么能告诉萨斯停止分裂?
我只是将我的项目文件迁移到D:驱动器上的新PC上,而我的程序(Git,Node Js,Ruby等)在C:驱动器上.
我compass watch在编辑SASS文件后尝试运行,但遇到此错误:
Errno::EACCES on line ["897"] of C: Permission denied - <D:/project_dir/stylesheets/app.css20140323-10532-gziux, D:/project_dir/stylesheets/app.css>
Run with --trace to see the full backtrace
Run Code Online (Sandbox Code Playgroud)
我在命令行使用Ruby是一个新手(因为我只将它用于Web开发目的).我需要做什么才能允许权限?
如果我能提供更多信息,请告诉我.
编辑:这是运行后返回的内容compass watch --trace:
D:\project_dir>compass watch --trace
>>> Change detected at 21:53:53 to: app.scss
overwrite stylesheets/app.css
Errno::EACCES on line ["897"] of C: Permission denied - (D:/project_dir/stylesheets/app.css20140323-14712-11v62k7, D:/project_dir/stylesheets/app.css)
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.2.18/lib/sass/util.rb:897:in `atomic_create_and_write_file'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/actions.rb:58:in `write_file'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:143:in `compile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:118:in `compile_if_required'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:103:in `block (2 levels) in run'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:101:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:101:in `block in run'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:126:in …Run Code Online (Sandbox Code Playgroud) 我有一个mixin设置来进行跨浏览器计算,
@mixin calc($property, $expression...) {
#{$property}: -moz-calc(#{$expression});
#{$property}: -o-calc(#{$expression});
#{$property}: -webkit-calc(#{$expression});
#{$property}: calc(#{$expression});
}
Run Code Online (Sandbox Code Playgroud)
我也有一个变量.
$line: 12px;
Run Code Online (Sandbox Code Playgroud)
我希望能够在其中使用变量.
@include calc(width, "30% - ( $line * 2) ) ");
Run Code Online (Sandbox Code Playgroud)
但我不确定这是不是最好的方法.