add instructions for autoprefixer and NodeJS (issue #54)
did
committed Feb 16, 2016
commit 818f7253f687c9ab996e8921a9e082aab76c9aca
Showing 2
changed files with
18 additions
and 1 deletions
locomotive/steam/initializers/sprockets.rb b/lib/locomotive/steam/initializers/sprockets.rb
+7
-1
| @@ | @@ -53,7 +53,13 @@ module Locomotive::Steam |
| params = (::YAML.load_file(file) || {}).symbolize_keys | |
| AutoprefixerRails.install(self, params) | |
| - | Locomotive::Common::Logger.info "Autoprefixer detected and installed".light_white + "\n\n" |
| + | Locomotive::Common::Logger.info "[Autoprefixer] detected and installed".light_white |
| + | |
| + | if ENV['EXECJS_RUNTIME'].blank? |
| + | Locomotive::Common::Logger.warn "[Autoprefixer]".light_white + " [Warning] if you notice bad performance, install NodeJS and run \"export EXECJS_RUNTIME=Node\" in your shell" |
| + | end |
| + | |
| + | Locomotive::Common::Logger.info "\n" |
| end | |
| end | |
spec/unit/initializers/sprockets_spec.rb
+11
-0
| @@ | @@ -24,6 +24,8 @@ describe Locomotive::Steam::SprocketsEnvironment do |
| describe '#install_autoprefixer' do | |
| + | let(:options) { { minify: false } } |
| + | |
| subject { env } | |
| context "config/autoprefixer.yml doesn't exist" do | |
| @@ | @@ -43,6 +45,15 @@ describe Locomotive::Steam::SprocketsEnvironment do |
| it { expect(AutoprefixerRails).to receive(:install).and_return(true); subject } | |
| + | it 'warns developers if they notice bad performance when using autoprefixer' do |
| + | curent_execjs_runtime = ENV['EXECJS_RUNTIME'] |
| + | ENV['EXECJS_RUNTIME'] = 'NodeJS' |
| + | expect(Locomotive::Common::Logger).not_to receive(:warn) |
| + | expect(AutoprefixerRails).to receive(:install).and_return(true) |
| + | subject |
| + | ENV['EXECJS_RUNTIME'] = curent_execjs_runtime |
| + | end |
| + | |
| end | |
| end | |