1
0
Fork 0
mirror of https://github.com/twbs/bootstrap-sass.git synced 2022-11-09 12:27:02 -05:00

Fix compass manifest

Compass generator will copy javascripts and fonts on project creation
Refs #645
This commit is contained in:
Gleb Mazovetskiy 2014-06-24 04:21:35 +02:00
parent 0d415362db
commit 430a80a2be
3 changed files with 27 additions and 21 deletions

View file

@ -82,8 +82,8 @@ compass create my-new-project -r bootstrap-sass --using bootstrap
This will create a new Compass project with the following files in it:
* [_bootstrap-variables.scss](/templates/project/_bootstrap-variables.sass.erb) - all of bootstrap variables (override them here).
* [styles.scss](/templates/project/styles.sass) - main project SCSS file, import `variables` and `bootstrap`.
* [styles.scss](/templates/project/styles.sass) - main project Sass file, imports Bootstrap and variables.
* [_bootstrap-variables.scss](/templates/project/_bootstrap-variables.sass.erb) - all of Bootstrap variables, override them here.
Some bootstrap-sass mixins may conflict with the Compass ones.
If this happens, change the import order so that Compass mixins are loaded later.

View file

@ -3,23 +3,24 @@ description 'Bootstrap for Sass'
# Stylesheet importing bootstrap
stylesheet 'styles.sass'
# SCSS:
assets = '../../assets'
manifest = Pathname.new(File.dirname(__FILE__))
assets = File.expand_path('../../assets', manifest)
# Provide variables files
bs_stylesheets = "#{assets}/stylesheets/bootstrap"
stylesheet '_bootstrap-variables.sass.erb', :to => '_bootstrap-variables.sass', :erb => true,
:bs_variables_path => File.expand_path("#{bs_stylesheets}/_variables.scss", File.dirname(__FILE__))
stylesheet '_bootstrap-variables.sass.erb',
:erb => true,
:to => '_bootstrap-variables.sass',
:bs_variables_path => File.expand_path("#{bs_stylesheets}/_variables.scss", manifest)
# JS:
bs_javascripts = "#{assets}/javascripts/bootstrap"
Dir.glob File.expand_path("#{bs_javascripts}/*.js", File.dirname(__FILE__)) do |path|
file = File.basename(path)
javascript "#{bs_javascripts}/#{file}", :to => "bootstrap/#{file}"
end
bs_fonts = "#{assets}/fonts/bootstrap"
Dir.glob File.expand_path("#{bs_fonts}/*", File.dirname(__FILE__)) do |path|
file = File.basename(path)
font "#{bs_fonts}/#{file}", :to => "bootstrap/#{file}"
# Copy JS and fonts
{:javascript => 'javascripts',
:font => 'fonts'
}.each do |method, dir|
root = Pathname.new(assets).join(dir)
Dir.glob root.join('**', '*.*') do |path|
path = Pathname.new(path)
send method, path.relative_path_from(manifest).to_s,
:to => path.relative_path_from(root).to_s
end
end

View file

@ -1,8 +1,13 @@
require 'test_helper'
class CompassTest < Test::Unit::TestCase
def test_create_project_with_boostrap
command = 'compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
assert silence_stream(STDOUT) { system(command) }, 'Compass project creation failed!'
def test_create_project
command = 'rm -rf tmp/new-compass-project; compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
success = if ENV['VERBOSE']
system command
else
silence_stream(STDOUT) { system(command) }
end
assert success, 'Compass project creation failed!'
end
end