我正在使用中间人3.3.3与bower安装一些js / css包。 我可以让我的scss工作,但中间人找不到susy框架的位置。 (在bower_components内)。 我也在使用midman-sprockets。
所以我的config.rb是这样的:
activate :sprockets
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", layout: false
#
# With alternative layout
# page "/path/to/file.html", layout: :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
# proxy "/this-page-has-no-template.html", "/template-file.html", locals: {
# which_fake_page: "Rendering a fake page with a local variable" }
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Reload the browser automatically whenever files change
# activate :livereload
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
ready do
sprockets.append_path File.join root, 'bower_components'
end
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
# activate :minify_css
# Minify Javascript on build
activate :minify_javascript
# Enable cache buster
# activate :asset_hash
activate :gzip
# Use relative URLs
activate :relative_assets
# Or use a different image path
# set :http_prefix, "/Content/images/"
end
我的文件树就像:
的myproject - bower_components - 苏西 - 萨斯 - lib - 模板 - bower.json - ...... - 配置 - 脚本 - 资源 - 样式表 - all.css --_setting.scss - ...... - bower.json - config.rb - ....
all.css
/*
* This file is the same as rails' application.scss
*/
//= require "_settings"
_settings.scss
// Add all required scss files/folders
@import "susy";
我得到的错误告诉我它继续在源/样式表中搜索“susy”。 任何一个?
答案 0 :(得分:0)
Sprockets支持Bower,因此您可以直接添加Bower组件路径:
sprockets.append_path File.join root, 'bower_components'
http://middlemanapp.com/basics/asset-pipeline/#sprockets-import-path
答案 1 :(得分:0)
在config.rb
我添加了
sass_dir = 'source/stylesheets', 'bower_components'
after_configuration do
@bower_config = JSON.parse(IO.read("#{root}/.bowerrc"))
sprockets.append_path File.join "#{root}", @bower_config["directory"]
end
在mymain.scss
@import "bourbon";
@import "susy/sass/susy";
@import "normalize.scss/normalize";
所有这些都来自凉亭