I'm trying to get Bower to install this javascript:
https://github.com/markmalek/Fixed-Header-Table
I use: bower install git#github.com:markmalek/Fixed-Header-Table.git --save
It installs the package into bower-components, and even adds it to my project's bower.json, but it doesn't add the to my html. I'm guessing it's because that particular git repo doesn't contain a bower.json telling my project which js file is the main one. So how do I install this package?
Thanks!
This answer takes your assumption that your HTML is picking up scripts loaded via Bower using the bower.json file as correct.
There are two options. The quickest is to fork the repo yourself, and in the main directory use the command bower init to create your own bower.json file in your forked version of the repo. Then, change the github url to the repo to your forked version rather than the original you have above.
The second option is to submit a pull request to the package owner adding a bower.json file so that you can continue to pull directly from his repo.
There are probably more options like manually loading the script outside of pulling from a bower.json file but the two above seem simplest.
Related
I've been trying multiple solutions to integrate bower assets in jekyll but none seem simple enough or future safe.
One interesting solution would be to add to sass_dir all gem assets dirs from any https://rails-assets.org gem (which converts any bower repo into a assets gem automatically) but I did not find docs that says it's possible.
Or use bower and import the sass files. But without grunt.
The goal is to be able to #import sass from asset gems, push on gh-pages branch and let github deploy without any extra step.
I ended up adding the bower packages directly to the _sass dir. No special config except your .bowerrc file should point to the _sass dir:
{
"directory" : "_sass"
}
It's not ideal for big projects but in my case it fits perfectly my needs.
This solution is the simplest if you're directly pushing to gh-pages branch directly.
If you have a more complex setup and many bower packages, then I think I'd go for a custom build with 2 branches and a grunt based flow.
Then you can use sass load_paths as mentioned here https://github.com/jekyll/jekyll/issues/3366
sass:
sass_dir:
- _sass
- bower_components
What is the difference? I realise that they get put into different object properties in bower.json but I can't seem to figure out why you need two separate properties for this, why not just use one.
From the documentation:
-S, --save: Save installed packages into the project’s bower.json dependencies
-D, --save-dev: Save installed packages into the project’s bower.json devDependencies
But there is no explanation of the difference between the two. When should I be saving in dependencies vs devDependencies?
Same case than in npm. Packages that you use in production should go inside dependencies and those that do not inside devDependencies.
The idea is that you are able to install only --production or --development variables, depending on the environment you are deploying your code.
From another answer in this community: What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?
Is there any way to get bower to ignore certain directories/files for download if the package does not itself use "ignore" in its bower.json?
Currently I am using a script inside of npm to remove the directory.
Use the init flag to create a JSON file dynamically:
bower init
Some libraries don't have an already build JavaScript file in their Github repository because the authors of these libraries are against keeping build artifacts around (Sinon.JS for example). Is there a preferred way to deal with this using Bower?
I know that I could fork the repository and register my fork with the prebuilt file with Bower. I'm just not sure if this is the best/correct way to handle this.
If there's not a proper Bower package registeres, you can install from any git repo (you can specify versions if there are proper git tags), and even from a .zip or .tar.gz files if you provide an url.
This is from http://bower.io/
bower install <package>
Where <package> can be any one of the following:
A name that maps to a package registered with Bower, e.g, jquery.
A remote Git endpoint, e.g., git://github.com/someone/some-package.git. Can be public or private.
A local Git endpoint, i.e., a folder that's a Git repository.
A shorthand endpoint, e.g., someone/some-package (defaults to GitHub).
A URL to a file, including zip and tar.gz files. It's contents will be extracted.
Of course you won't get any dependency resolution this way, but you can take care of that manually adding any dependency explicitly to your bower.json file
Currently that is the best way. You can also keep it locally and reference it in 'dependencies' with full path. We're working on adding ability for author to publish components, like npm.
In recent versions of Grails install-plugin command has been deprecated. What is now the recommended way of installing a plugin that is not available via some repository. Assume the plugin is only available locally as zip file, e.g. after running grails package-plugin?
I think the easiest approach is to place the zip file in the project's lib folder and then add an entry in the BuildConfig.groovy. For example:
1. 'grails-image-tools-1.0.5.zip' placed in lib.
2. runtime ":grails-image-tools:1.0.5" added to BuildConfig.groovy
Since the dependency manager looks inside the project's lib folder as well, I don't have to worry about setting any paths etc.
EDIT:
The latest Grails version that I worked on was 2.1.1. I'm unable to check but according to #Saurabh's comment below this isn't applicable for Grails 2.4.3
EDIT2:
But #Jay says that it works with 2.4.5
I don't know if it is the correct way but we get it working:
Download and unzip the plugin in a directory within your project
Change your BuildConfig.groovy file to point to the new plugin
Example: Download webflow.zip plugin and unzip it into a plugins directory within your project. Add this line at end of your BuildConfig file
grails.plugin.location."webflow" = "plugins/webflow"