-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jquery install example only works with link to dist/jquery.js #11
Comments
The same for angular-ui - I have to use angular-ui/build/angular-ui.js It's a bit confusing, I have to check each component to find it's files. |
I'm new to bower, but just wondering if the finder should be able to use the 'main' component of bower.json ? In the jquery case, it points to dist/jquery.js So, the finder should possibly be able to return it if you do jquery/jquery.js ? |
Ah, interesting .. I'm very new to bower .. (as of 3 days ago in fact). How about template tags instead ? {% bower_scripts %}
To find out if something is javascript, python mimetypes could be used at installation time: import mimetypes
mimetypes.guess_type("bootstap.js")
('application/javascript', None) {% bower_stylesheets %} Could do the same for stylesheets. These could have options to limit them to certain bower apps {% bower_scripts "angularjs", "ng-grid" %} (I'm not entirely sure if that notation will work for templates, but basically some way of passing the script names). |
I don't think an automatic way of discovery is the way to go, since there's no guarantee how each bower package structures its code and artifacts. I think the best you can hope for is to manually add your own mapping to alias the package structure, something like: BOWER_COMPONENTS_MAPPING = {
'jquery': 'jquery/dist',
'angular': 'angular-ui/build',
'bootstrap': 'bootstrap-sass-official/vendor/assets',
} I would hook that into the behavior for For certain purposes, template tags are too late, such as django-pipeline. Your other options are:
But you'll have to be pretty sure that the packages don't collide with each other in terms of their component names. file 'build/jquery.zip',
'https://github.com/jquery/jquery/archive/2.1.0.zip' do |fp|
build_dir = File.dirname(fp)
unzipped_dir = File.join(build_dir, 'jquery-2.1.0')
static_dir = 'bower_components/jquery'
system "cd #{build_dir} && unzip -o #{File.basename(fp)}"
system "rm -rf #{static_dir}"
system "mkdir -p #{static_dir}"
system "cp -r #{unzipped_dir}/dist/* #{static_dir}"
end |
Ahh.. yes, I didn't think about the fact that something listed in main could call resources not listed. Once I've added more bower dependencies to my project I might have a go at auto discovery and see if I can make it work. |
Good luck! ✌️
|
Please change the documentation of django-bower and replace the path in the example line It may avoid some initial frustration with this great package and everyone understands that one has to look for the exact path inside bower_components. |
Please see nvbn#11 for the discussion.
See nvbn#11 for the full discussion
I installed jquery, but
/static/jquery/jquery.js did not work, however /static/jquery/dist/jquery.js did work - is this a configuration issue on my side ?
The text was updated successfully, but these errors were encountered: