How can i specify framework version in compass cre

2019-02-10 23:22发布

问题:

i have two gem versions of foundation framework installed. i want to specify version of framework before create project.

compass create <project-name> -r zurb-foundation --using foundation

i can create only with current framework version now.

回答1:

You can run multiple versions of foundation. There is some documentation on how to do that at:

http://foundation.zurb.com/docs/sass.html

under Running multiple versions

I wanted to have the latest version of Foundation 3 as well as the most current version of 4. You can check the available versions here:

https://rubygems.org/gems/zurb-foundation/versions

I saw that 3.2.5 was the latest version. You can install it by running gem.

gem install zurb-foundation --version 3.2.5

now if you run gem list

you will see something like zurb-foundation (4.0.3, 4.0.2, 3.2.5) at the end

Now, if you run compass it will automatically use the latest version so we will need to use bundler instead. Create a new directory and create a Gemfile.

mkdir myApp
cd myApp
touch Gemfile

then edit the Gemfile with your editor of choice so it looks like this:

source "https://rubygems.org"
# Replace 4.0.3 with the version of Foundation you want to use
gem "zurb-foundation", "3.2.5"
gem "compass"

then run bundler to exec compass:

bundle exec compass create . -r zurb-foundation --using foundation

this will build out everything just as compass does normally, but with the specific version you specify.