chlorinejs / lein-bower

Leiningen plugin for managing Bower dependencies in Clojure projects
66 stars 13 forks source link

Feature request: Can I get availability for saving generated bower.json and .bowerrc? #13

Open DeLaGuardo opened 10 years ago

DeLaGuardo commented 10 years ago

Now it is impossible to start postnatal scripts that required bower.json

:bower {:scripts {:postinstall "./node_modules/.bin/wiredep -s resources/public/index.html"}}

This script rise error.

radhikalism commented 10 years ago

Can you describe what error you get?

It's not pretty, but I am able to make wiredep work with something like this:

  :plugins [[lein-bower "0.5.1"]
            [lein-npm "0.4.0"]]
  :node-dependencies [[wiredep "1.8.5"]
                      [bower "1.3.10"]]
  :bower {:scripts {:postinstall "./node_modules/.bin/wiredep -d resources/public/vendor/ -s resources/public/index.html"}}
  :bower-dependencies [[jquery "2.1.1"]]

With that:

$ lein bower install jquery
bower jquery#2.1.1              cached git://github.com/jquery/jquery.git#2.1.1
bower jquery#2.1.1            validate 2.1.1 against git://github.com/jquery/jquery.git#2.1.1
bower jquery#*                  cached git://github.com/jquery/jquery.git#2.1.1
bower jquery#*                validate 2.1.1 against git://github.com/jquery/jquery.git#*
bower jquery#2.1.1             install jquery#2.1.1
bower                      postinstall ./node_modules/.bin/wiredep -d resources/public/vendor/ -s resources/public/index.html
bower                      postinstall resources/public/index.html modified.

I guess the two things to keep in mind are that bower should be run indirectly with lein bower so that bower.json is available in the environment, and that your bower dependencies should be declared statically in your project.clj before you run lein bower install (since --save won't persist and lein-bower doesn't have an equivalent yet).