linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 80 forks source link

Using third party libraries with lineman #322

Closed ktyacke closed 10 years ago

ktyacke commented 10 years ago

Hey guys, First off, kudos on a very useful tool! I've dug through the information on the linemanjs website, but am still a bit confused as to the best way to include third party libraries/frameworks in my project. I read over the section about using lineman fetcher; however, the repo for available items to be fetched is rather limited, and does not include the libs I'm looking for.

To give a specific use case: I'm using AngularJS with Bootstrap in my project. I cloned the "lineman-angular-template" (which includes foundation by default) to create my base project. If I now wanted to add Bootstrap, and (more importantly/confusing) Angular-UI (a set of Angular Directives for using Bootstrap components), how would I go about doing that with lineman?

Thanks in advance for any info you can provide, and for creating a really great tool!

-Kyle

jasonkarns commented 10 years ago

Fetcher is used as a convenience. All it does is download the necessary dependency and drops it in the appropriate (js/css/img, etc) folder under /vendor. So you can just download any dep manually and place it in /vendor.

Any files in vendor are included before /app, so any dependency will be available before your app. If, however, there are load-order requirements between dependencies, you can utilize /config/files.js to specify the ordering. The skeleton files.js includes an example (commented out).

ktyacke commented 10 years ago

Ok, that makes sense. One (possibly newb) question: After placing my files (lib) in the /vendor directory, do I then need to manually include the jss/css/etc. files in my document or is this handled by Lineman (or one of the underlying technologies such as Grunt)?

Thanks for the response!

-Kyle

davemo commented 10 years ago

Hey @ktyacke, if you put files in vendor/js or vendor/css they'll get picked up automatically due to lineman configuring the grunt tasks for those folders (js and css, respectively) with a file glob vendor/css/**/*.css, if you want to add some additional folders inside of vendor, like vendor/lib you'd need to modify config/files.{coffee,js} to add your lib directory:

# files.coffee
css:
  vendor: [
    'vendor/lib/myfile.css'
    'vendor/css/**/*.css'
  ]
davemo commented 10 years ago

Also, you can explore the default configuration for the grunt tasks from the command line using lineman config files and even narrow down to a subset of configuration, for example if I wanted to see linemans configuration for filepaths for all vendor js i would use lineman config files.js.vendor

screen shot 2014-09-22 at 12 14 20 pm

ktyacke commented 10 years ago

That's awesome, thanks for the help guys!

-Kyle

On Mon, Sep 22, 2014 at 9:14 AM, David Mosher notifications@github.com wrote:

Also, you can explore the default configuration for the grunt tasks from the command line using lineman config files and even narrow down to a subset of configuration, for example if I wanted to see linemans configuration for filepaths for all vendor js i would use lineman config files.js.vendor

[image: screen shot 2014-09-22 at 12 14 20 pm] https://cloud.githubusercontent.com/assets/69559/4359632/8af2c170-4273-11e4-937a-9e9273938660.png

— Reply to this email directly or view it on GitHub https://github.com/linemanjs/lineman/issues/322#issuecomment-56397943.