rharriso / bower-rails Goto Github PK
View Code? Open in Web Editor NEWBundler-like DSL + rake tasks for Bower on Rails
License: MIT License
Bundler-like DSL + rake tasks for Bower on Rails
License: MIT License
I think we need a new version. The only question I have is semantic.
Should the new version be
0.5.1
or
0.6.0
I'm leaning towards 0.6.0 because of the new features.
$ rake bower:clean
rake aborted!
Don't know how to build task 'bower:clean'
(See full trace by running task with --trace)
Hey I see #19. Is there a way to bower instal <package> --save
to add a new dependency and persist it to bower.json
?
I'm getting this:
Sprockets::FileNotFound: couldn't find file '/Users/josh/Documents/Work/MuheimWebdesign/base/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css'
It seems that in bower.json
, bootstrap.css
listed:
"main": ["./dist/js/bootstrap.js", "./dist/css/bootstrap.css"],
But there's no bootstrap.css
but only a bootstrap.css.erb
. How can I solve this problem?
Great project!
Per the guide:
app/assets is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets.
lib/assets is for your own libraries’ code that doesn’t really fit into the scope of the application or those libraries which are shared across applications.
vendor/assets is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks.
In the case of Bower, it is pulling Javascript in from external sources, so the Javascript is neither "owned by the application" nor are they "your own libraries' code", so it belongs in vendor/assets/javascripts
. I notice that the default group is 'lib' per @groups = ["lib"] if @groups.empty?
in lib/bower-rails/dsl.rb
, which would make js by default go into lib/assets/javascripts
.
If that were changed to default to 'vendor', then to clear things up in the readme, perhaps the example section might look like:
Example Jsfile:
js "jquery" js "backbone", "1.2"
That puts the latest JQuery (according to Bower) and v1.2 of Backbone into
vendor/assets/javascripts
.The Jsfile can specify
assets_path
to change the default relative path under app, lib, vendor, etc. directories, or you can specify it per directory (a.k.a. "group"), e.g.:assets_path "assets/javascript" # Puts files under ./vendor/assets/js group :vendor, :assets_path => "assets/js" do js "jquery" # Assumes it's latest js "backbone", "1.2" end # Puts files under ./lib/assets/javascript group :lib do js "jquery" js "backbone", "1.2" end
Last night, I was struggled with how to make my assets precompile properly. Everything is alright except the libs with additional assets(fonts,images,...).
For example, I required the less file of font-awesome in my application.less
. So it can be compile into application.css
, this works well but missing the fonts.
What the right way that I can handle assets like this? Thank you!
If clean
and resolve
enabled, bower_rails removes *.css.erb files.
bower_rails.clean_before_precompile = true
bower_rails.resolve_before_precompile = true
bower:clean
runs after bower:resolve
https://github.com/42dev/bower-rails/blob/6768e03422501f9ed54931e9498e384260e48a23/lib/bower-rails.rb#L35
What do you think if we change order of these tasks?
I need bower:clean
, because there are some bower libraries that contain .less files. These .less files crashes assets:precompile
.
With Bowerfile
like
# Puts files under ./vendor/assets/javascripts/bower_components
group :lib, :assets_path => "assets/javascripts" do
asset "modernizr"
end
# Puts files under ./vendor/assets/stylesheets/bower_components
group :vendor, :assets_path => "assets/stylesheets" do
asset "purecss"
end
rake bower:install
installs assets additionally to default dir - vendor/assets
but it shouldn't.
I am usign bootstrap which have additional font, which work fine in development because relative path looks like
/assets/bootstrap/less/bootstrap.css
unfortunatelly in test environment assets are compiled to one file
/assets/application.css
but relative url is still the same, so url to font is now
/font/glyphicon....
which is incorrect, so is there any way to fix it ?
Hi. I have a question.
When deploy with Capistrano, the following error occurs in the precompile.
How do I fix it?
thanks!
/opt/rbenv/bin/rbenv exec bundle exec rake assets:precompile
Rails Error: Unable to access log file. Please ensure that /var/ignition/releases/20140520083946/log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
rake aborted!
Errno::EACCES: Permission denied @ rb_sysopen - /var/ignition/releases/20140520083946/vendor/assets/bower.json
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/bower-rails/dsl.rb:62:in `initialize'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/bower-rails/dsl.rb:62:in `open'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/bower-rails/dsl.rb:62:in `block in write_bower_json'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/bower-rails/dsl.rb:60:in `each'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/bower-rails/dsl.rb:60:in `write_bower_json'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/bower.rake:98:in `dsl_perform_command'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/bower.rake:78:in `perform'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/bower.rake:11:in `block (2 levels) in <top (required)>'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/bower.rake:58:in `block (2 levels) in <top (required)>'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/bower.rake:57:in `map'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/bower.rake:57:in `block in <top (required)>'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/helpers/before_hook.rb:11:in `call'
/var/ignition/shared/bundle/ruby/2.1.0/gems/bower-rails-0.7.3/lib/tasks/helpers/before_hook.rb:11:in `block (2 levels) in before'
Tasks: TOP => bower:install
(See full trace by running task with --trace)
I was wondering what you think about using your approach for a non Rails project, e.g. a small discussion is going on here:
Hey guys, hope this question is in place:
Can you please describe in which cases you'd put your assets under lib and in which cases under vendor?
Is there any reason to put them in both?
Thanks,
Miki
When I install a bower package in my Rails app via a Bowerfile it puts it in:
./vendor/assets/bower_components/[package_name]/[package_name.js]
For example installing underscore would put the underscore.js file at:
./vendor/assets/bower_components/underscore/underscore.js
Now to require it via sprockets I have to specify it like:
//= require underscore/underscore
Is there a way I can set it to only have to specify:
//= require underscore
The gem need the node
-binary from nodejs-legacy in order to run.
The error that appears when nodejs-legacy is not installed.
/vagrant vagrant@vagrant-ubuntu-trusty-64% rake bower:list
/usr/local/bin/bower list
rake aborted!
Command failed with status (1): [/usr/local/bin/bower list...]
Tasks: TOP => bower:list
(See full trace by running task with --trace)
/vagrant vagrant@vagrant-ubuntu-trusty-64% rake bower:install
bower.js files generated
/usr/local/bin/bower install
/usr/bin/env: node: No such file or directory
rake aborted!
Command failed with status (127): [/usr/local/bin/bower install ...]
Tasks: TOP => bower:install
(See full trace by running task with --trace)
Solution:
sudo apt-get install nodejs-legacy
Should the documentation mention this?
Is it known or intentional that I can't do rake bower:install [package name]
?
± |master ✓| → ./bin/rake bower:install --trace jquery.cookie
Error
** Invoke bower:install (first_time)
** Execute bower:install
bower install
bower install
bower downloading http://code.origin.jquery.com/jquery-1.10.2.min.js
bower downloading https://raw.github.com/browserstate/history.js/master/scripts/bundled/html4+html5/jquery.history.js
bower installing history.js
bower installing jquery
rake aborted!
Don't know how to build task 'jquery.cookie'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task_manager.rb:49:in `[]'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:142:in `invoke_task'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/Users/milesmatthias/dojo4/dj4/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
./bin/rake:16:in `load'
./bin/rake:16:in `<main>'
The jquery and history.js are entries in my bower.json
.
The version of this gem tagged as 0.6.1
references 0.6.0
. Should it be re-tagged?
Hello!
I really appreciate bower-rails, but so far it seems to be only useful for js-only packages.
I tried to get Bootstrap to work, and while figuring out how to integrate it correctly into my development process, it doesn't work for production, as there are some issues with relative paths and other assets (like e.g. fonts), as you may already know.
Are you interested in some help fixing these? I'm thinking of two things:
Fix the relative assets problem. I think this shouldn't be a big problem, as resolve_asset_paths looks pretty simple. Instead of converting the .css
file into a .css.erb
file I suggest replacing all file paths directly and saving the file as normal .css
file.
Copy additional assets to public/assets
. This should be possible, too. I don't really know where's specified which files should be available for use (I could imagine that it's the main
directive), but then we could simply copy the files to the Rails public/assets
directory.
I think the directory tree should be
vendor
└── assets
├── bower_components
│ ├── angular
│ │ ├── angular.js
│ │ ├── angular.min.js
│ │ └── bower.json
│ └── angular-resource
│ ├── README.md
│ ├── angular-resource.js
│ ├── angular-resource.min.js
│ └── bower.json
├── javascripts
└── stylesheets
not
vendor
└── assets
├── app
│ └── bower_components
│ ├── angular
│ │ ├── angular.js
│ │ ├── angular.min.js
│ │ └── bower.json
│ └── angular-resource
│ ├── README.md
│ ├── angular-resource.js
│ ├── angular-resource.min.js
│ └── bower.json
├── javascripts
└── stylesheets
There is an additional directory app
. I don't think it is necessary.
I'm using Rails 3.2.12 and bower-rails 0.2.1
expected
rake bower:dsl:install
to use Jsfile.rb in Rails root folder and install dependencies
got an error
rake aborted!
Don't know how to build task 'bower:dsl:install'
I added gem 'bower-rails'
to my Gemfile and did
$ bundle
...
Installing bower-rails (0.1.3)
...
$ bundle exec rails g bower_rails:initialize
Could not find generator bower_rails:initialize.
Additional information:
$ bundle exec rails -v
Rails 3.1.10
$ bundle exec rake -T | grep bower
rake bower:install # install files from bower
rake bower:update # update bower packages
$ node -v
v0.8.18
$ npm -v
1.2.2
$ npm list -g bower
/usr/local/share/npm/lib
└── [email protected]
I guess we need to release 0.6.1 version as 0.6.0 was released with a confusing feature (#49 (comment), #49 (comment), #53) which was removed then.
I have following cap task
desc 'Install bower'
namespace :bower do
task :install do
on roles(:all) do
within release_path do
execute :rake, 'bower:install'
end
end
end
end
When i'm deploying
DEBUG [f60c0b12] Command: cd /srv/www/site.ru/releases/20131011094022 && ( RAILS_ENV=production ~/.rvm/bin/site_rake bower:install )
DEBUG [f60c0b12] bower.js files generated
DEBUG [f60c0b12] bower install
DEBUG [f60c0b12] rake aborted!
DEBUG [f60c0b12] Command failed with status (127): [bower install...]
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:8:in `block (3 levels) in <top (required)>'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:79:in `block (2 levels) in dsl_perform_command'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:78:in `chdir'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:78:in `block in dsl_perform_command'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:77:in `each'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:77:in `dsl_perform_command'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:49:in `perform'
DEBUG [f60c0b12] /srv/www/site.ru/shared/bundle/ruby/2.0.0/bundler/gems/bower-rails-d65da95c0614/lib/tasks/bower.rake:7:in `block (2 levels) in <top (required)>'
DEBUG [f60c0b12] Tasks: TOP => bower:install
DEBUG [f60c0b12] (See full trace by running task with --trace)
I changed bower.rake to
perform do
system( 'bower install' )
end
instead of
perform do
sh 'bower install'
end
and it works.
Do you have any suggestings?
Firstly, thanks for a great piece of work.
I'm having a little trouble deploying to my Heroku staging server. I am using npm to manage the node modules (used to install bower). Using npm means that I must use a multi buildpack using both node and ruby build packs (I'm using this: tool).
I can see that bower is installing in the git console output using npm:
Pushing to [email protected]:magpie-staging.git
Fetching repository, done.
-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs
=====> Detected Framework: Node.js
-----> Defaulting to latest stable node: 0.10.24
-----> Downloading and installing node
-----> Installing dependencies
npm http GET https://registry.npmjs.org/bower
npm http 200 https://registry.npmjs.org/bower
... blah blah blah (node downloading things)
-----> Caching node_modules directory for future builds
-----> Cleaning up node-gyp and npm artifacts
-----> Building runtime environment
Which means success as far as I know. Now, on to the Ruby bit...
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby
=====> Detected Framework: Ruby
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching source index from http://rubygems.org/
Installing rake (10.1.1)
it then install all the gems including Installing bower-rails (0.6.0)
. Next up is the DB and rake assets precompile...
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Running: rake assets:precompile
bower install
Installing dependencies into lib
Installing dependencies into vendor
rake aborted!
Command failed with status (127): [bower install...]
From research I have found that status 127 means bower is not found or the path is incorrect...
I know that this issue is probably out of the scope of your code, but it would be handy if you could let me know if you have seen this sort of error before on a Heroku deployment, or any ideas?
I'm happy to add to your README once a solution is found.
Thanks a lot.
I want to use https://github.com/winmarkltd/BootstrapFormHelpers using bower-rails. Sadly it doesn't specify a main
directive:
{
"name": "bootstrap-formhelpers",
"version": "2.3.0",
"homepage": "http://bootstrapformhelpers.com",
"authors": [
"Vincent Lamanna <[email protected]>"
],
"description": "A collection of jQuery plugins for Bootstrap.",
"dependencies": {
"bootstrap": "3.0.0"
}
}
How can I use it anyway?
And in your README you're stating:
The rake bower:clean task removes every file that isn't listed in the main directive, if the component specifies a main directive.
This seems a good idea, but you should also take the ignore
directive into account, as e.g. for Bootstrap, all files (including Glyphicons Halflings
font family, etc.) are removed, but they are still needed.
I have forked BootstrapFormHelpers and added the main
directive to it and created a PR.
As long as the PR isn't merged, I'd like to use my own branch.
asset 'bootstrap-formhelpers', github: 'jmuheim/BootstrapFormHelpers'
When installing, it seems that bower uses the correct repo:
bower bootstrap-formhelpers#* not-cached git://github.com/jmuheim/BootstrapFormHelpers.git#*
bower bootstrap-formhelpers#* resolve git://github.com/jmuheim/BootstrapFormHelpers.git#*
bower bootstrap-formhelpers#* download https://github.com/jmuheim/BootstrapFormHelpers/archive/2.3.0.tar.gz
Sadly, in the vendor/assets/bower_components/bootstrap-formhelpers/bower.json
file, the main
directive is still missing!
But in the used branch it clearly is there, see:
https://github.com/jmuheim/BootstrapFormHelpers/blob/master/bower.json
What could have gone wrong here?
Hi,
I like to fill a feature request. I use bower-rails for several days, and I like to use it as main assets dependencies manager for my mini CSS Framework. Unfortunately, bower-rails have some hard-coded restrictions for directories. In my opinion, every tool should allow developers to use it as they want, without restrictions. Many developers have their own preferences for ex. project directory structure.
Bower-rails restricts root directory to {vendor,lib}/assets. This is the first restriction that should be removed, so anyone can set their own root path. This can be useful in many cases, for example if bowler-rails is used with, Sinatra, or used for custom Rack project.
Also, bowler-rails should inherit paths in groups (Jsfile).
Take a look at this example Jsfile:
assets_path '/vendor/assets/javascripts'
group :frameworks do
js "bootstrap-2.3.2", "bootstrap#2.3.2"
end
IMO, this example Jsfile should create a bootstrap-2.3.2
folder in /vendor/assets/javascripts/frameworks
directory, which contains a bootstrap-2.3.2 files directly. Unfortunately, and not intuitively, bower-rails creates a Rails.root/javascripts/vendor/assets/javascripts/bower_components/bootstrap-2.3.2
directory. I consider this as a bug.
When I add packages like
asset 'handlebars'
to my Bowerfile I can only include the handlebars.js
file and not files like handlebars.runtime
.
I have added config.assets.paths << Rails.root.join('vendor', 'assets', 'bower_components')
to my config/application.rb
I run bower-rails with JRuby. When some assets have conflicts, both rake bower:install
and rake bower:update
don't work properly.
...
bower handlebars#>= 1.0.0 cached git://github.com/components/handlebars.js.git#2.0.0-alpha.1
bower handlebars#>= 1.0.0 validate 2.0.0-alpha.1 against git://github.com/components/handlebars.js.git#>= 1.0.0
bower jquery#>= 1.9.0 cached git://github.com/components/jquery.git#2.1.0
bower jquery#>= 1.9.0 validate 2.1.0 against git://github.com/components/jquery.git#>= 1.9.0
bower ECONFLICT Unable to find suitable version for ember
rake aborted!
Command failed with status (1): [/usr/local/bin/bower update...]
org/jruby/RubyProc.java:271:in `call'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:24:in `(root)'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:72:in `perform'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:99:in `dsl_perform_command'
org/jruby/RubyDir.java:476:in `chdir'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:98:in `dsl_perform_command'
org/jruby/RubyArray.java:1613:in `each'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:97:in `dsl_perform_command'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:71:in `perform'
/Users/towerhe/Repositories/Codes/oa/ams/vendor/bundle/gems/bower-rails-0.7.0/lib/tasks/bower.rake:23:in `(root)'
org/jruby/RubyProc.java:271:in `call'
org/jruby/RubyArray.java:1613:in `each'
org/jruby/RubyArray.java:1613:in `each'
org/jruby/RubyKernel.java:1103:in `load'
Tasks: TOP => bower:update
(See full trace by running task with --trace)
I am just experimenting with a fresh Rails 4.0 app, after creating this bower.json:
{ "lib": { "dependencies": { "jquery": "latest", "underscore": "latest", "backbone": "latest" } }, "vendor": { "dependencies": { } } }
When I require the libs with:
//= require jquery //= require underscore //= require backbone
I get:
module.exports = require('./backbone');
Which Sprockets can apparently not resolve.
Any ideas what I might miss?
Hello,
I want use rails-bower with my rails engine. It has custom assets.
So i create my custom task, for installing bower assets to my engine. I need change only one method - get_bower_root_path.
But instead of this i copy a lot of methods.
Can you extract one service or library for bower dsl and perform method?
With bower-rails gaining some nifty features we're looking into fulling integrating bower-rails into our stack. One big roadblock is that we have many Rails engines in our app. In order to integrate bower-rails we need to be able to declare bower dependencies inside these gems. And I'm not sure what's the right approach here.
I briefly looked into this and with my limited knowledge of engine I think this can be achieved by:
a) Changing @@bowerfile
to a directory and pick up anything in it during eval.
b) Provide custom initialization configuration for Bowerfile and merge with Bowerfile definition on init. Not sure about how load order impacts this.
I'm not sure which way is better, or if there's an even better way. Thoughts?
I am trying to install all packages specified in bowefile.rb
root@#> rake bower:install
bower.js files generated
/usr/local/bin/bower install -p
bower ESUDO Cannot be run with sudo
When I tried with --allow-root
root@#> rake bower:install --allow-root
invalid option: --allow-root
is there any other solution?
When running rake assets:precompile a project with source maps, bower-rails chokes.
After running
rm vendor/assets/bower_components/**/*.js.{gzip,map}
Everything compiles just fine.
See https://github.com/faun/bower-rails-bug for an example of this bug in action.
Here's a stack trace:
$ RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/faun/.rvm/rubies/ruby-2.0.0-p353/bin/ruby /Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Unexpected token: punc (:) (line: 2, col: 9, pos: 11)
Error
at new JS_Parse_Error (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:10748)
at js_error (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:10967)
at croak (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:19192)
at token_error (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:19329)
at unexpected (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:19417)
at semicolon (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:19890)
at simple_statement (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:22663)
at /private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:20380
at /private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:20063
at block_ (/private/var/folders/6d/rpsxr3p90qscdq0b4jnbpcrh0000gp/T/execjs20140106-81957-1kw1yt6.js:2357:24682)
(in /Users/faun/src/bower-rails-bug/vendor/assets/bower_components/angular-resource/angular-resource.min.js.map)/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:68:in `extract_result'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:28:in `block in exec'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:27:in `exec'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/uglifier-2.4.0/lib/uglifier.rb:184:in `really_compile'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/uglifier-2.4.0/lib/uglifier.rb:108:in `compile'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/compressors.rb:74:in `compress'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/processing.rb:265:in `block in js_compressor='
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/static_compiler.rb:19:in `block in compile'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/assets.rake:56:in `internal_precompile'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/faun/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/faun/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/bin/rake:23:in `load'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/faun/.rvm/rubies/ruby-2.0.0-p353/bi...]
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/file_utils.rb:54:in `block in create_shell_runner'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in `call'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in `sh'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/file_utils.rb:82:in `ruby'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/file_utils_ext.rb:37:in `ruby'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/actionpack-3.2.16/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/faun/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/bin/rake:23:in `load'
/Users/faun/.rvm/gems/ruby-2.0.0-p353@bower-rails-bug/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile
I wonder if it is possible to support the standard bower.json format? There's support for making bower compatible with heroku with buildpacks like https://github.com/qnyp/heroku-buildpack-ruby-bower but it requires a standard bower.json format. Perhaps bower-rails should not alter how bower.json is defined (after all, I don't think there's a strong need for lib/)
Sorry if this is a dumb question, but I can't seem to find this information in the README...
I've never used Bower before but I'm trying out this gem. I have a Rails 4.1.5 project. I ran the generator and added this line to my Bowerfile:
asset 'fitvids'
I ran the rake task to install it (which it successfully copied to the vendor directory. Now how to I start using this library in my app? I added this line to my application.js file, but it raised an error:
//= require fitvids
How am I expected to use Bower in my Rails application?
Hi,
When I run rake bower:install with the following Bowerfile:
assets_path "assets"
# Puts files under ./vendor/assets/javascripts/bower_components
group :js, :assets_path => "assets/javascripts" do
asset "modernizr"
end
# Puts files under ./vendor/assets/stylesheets/bower_components
group :css, :assets_path => "assets/stylesheets" do
asset "purecss"
end
The bower components are output to the assets folder rather than the javascripts and stylesheets folders. The structure is as follows:
assets/
-bower_components/
--modernizr/
--purecss/
-javascripts/
-stylesheets/
Any ideas?
Thanks
Can you update the gem on RubyGems to 0.5.0? Thanks!
Otherwise I need to "cd" to the assets dir and run "bower list" there.
Thank you for a very useful gem!
Hi,
why on rails g bower_rails:initialize
don't generate a default Bowerfile
?
Maybe with instructions how to add components like bundle init
.
If interested, send you a pull request with this feature.
Should I manually require the bower_components installed as a dependency of another component in my application.js ?
Hi,
I'm not sure how to use this gem.
I followed the step from the README.
My bower.json contains:
{
"lib": {
"name": "bower-rails generated lib assets",
"dependencies": {
}
},
"vendor": {
"name": "bower-rails generated vendor assets",
"dependencies": {
"sass-bootstrap": "git://github.com/jlong/sass-bootstrap.git",
"blueimp-file-upload": "~9.4",
"blueimp-gallery": "https://github.com/blueimp/Gallery.git",
"font-awesome": "https://github.com/FortAwesome/Font-Awesome.git"
}
}
}
The problem is I'm not sure what to require in application.js and application.css.
If for example I try *= require blueimp-file-upload
it does not work (couldn't find file 'blueimp-file-upload').
If the package blueimp-file-upload has multiple JS files, do I have to require them using separate require commands?
What is the right way?
Thanks.
The README for this project currently references a BowerRails.configure
method, which does not exist in ad2ec1b. I suspect this gem needs to be retagged.
I have bower_rails.rb as following
BowerRails.configure do |bower_rails|
bower_rails.install_before_precompile = true
bower_rails.resolve_before_precompile = true
bower_rails.clean_before_precompile = true
asset 'jquery', '1.11.1-rc2'
end
end
After running rake bower:install
, I got the only line here:
bower.js files generated
Then I checked out my lib folder, only to find that nothing was there. What happend?
Is there a solution to using bower-rails produced source maps for minified javascript files?
E.g. If you enable JS Source Maps in the chrome developer tool, install the jquery bower package from components/jquery (or any other package that has a *.min.map
file) via bower-rails, and use the min.js file in sprockets, you'll get a 404 to /assets/jquery.min.map/
.
I'm using this in a rails 4.0.0.rc1 app with the following dependencies:
{ "lib": { "dependencies": { } }, "vendor": { "dependencies": { "angular": "~1.1.4", "json3": "~3.2.4", "es5-shim": "~2.0.5", "angular-resource": "~1.1.4", "angular-cookies": "~1.1.4", "angular-sanitize": "~1.1.4", "angular-ui": "~0.4.0", "underscore": "~1.4.4", "angular-underscore": "63b991b5cbcc91af2a0f96710e5d9c6407f83dfd" } } }
But when I run rake bower:install, I just get:
bower install bower install
It returns nearly immediately and doesn't seem to have done anything. It would be nice to have a little more detail about what's happening here.
Both commands bower:install and bower:update remain in a rake abortion with status 127. Don't know what that means.
bundle exec rake bower:install
's output:
bower.js files generated
bower install
rake aborted!
Command failed with status (127): [bower install...]
Tasks: TOP => bower:install
(See full trace by running task with --trace)
And because of that i can't precompile my assets.
Mistake in the code or at my side? And if it is on my side, what does the status tell us?
Hi,
I want to use this in a gem, to manage the assets. How would I go about this? I get Don't know how to build task 'bower:install'
right now....
When I'm add bower-rails to engine there is no rake tasks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.