Bower: Installing legacy bootstrap (2.3.2) with bower

邮差的信 提交于 2019-12-21 16:53:28

问题


I have an open source webapp using bootstrap 2.3.2 and which Currently I can't move to bootstrap 3 (completely different grid system) - I'm trying to move the webapp to use bower to handle dependencies but bower install bootstrap#2.3.2 fetches something that looks as the raw code repo not built, for example no css folder, just the seperate less files, no one minified bootstrap.min.js but multiple different plugins (not concatenated) etc..

Is this fixable? should I install differently?


回答1:


You are doing everything correct. Take a look at the README for v2.3.2 on github

Bootstrap includes a makefile with convenient methods for working with the framework. Before getting started, be sure to install the necessary local dependencies:

$ npm install When completed, you'll be able to run the various make commands provided:

build - make

Runs the recess compiler to rebuild the /less files and compiles the docs. Requires recess and uglify-js.

test - make test

Runs jshint and qunit tests headlessly in phantomjs (used for ci). Depends on having phantomjs installed.

watch - make watch




回答2:


The solution I ended up with: forked bootstrap repo, cleaned up(other branches etc..) git reset --hard to the v2.3.2 tag - checked it into another branch and pushe it to github. more cleanup (removing the old master branch, higher tags). run the build processes and setup an "updated" dist folder for the v2.3.2 tag. changed the bower package and published it as bootstrap2.3.2 package.

Now I (and everyone else) can install with bower install from this repo. The results are here if someone want to use it.




回答3:


I just ran into this and was basically setting up my own fork of Bootstrap 2.3.2 (before I noticed your answer). As I dove in, I noticed that Bootstrap 2.3.2 actually does come with pre-built assets you can use in your project. While it's not as obvious as the dist/ directory in Bootstrap 3, you can find the location of the prebuilt assets in the project's bower.json:

"main": ["./docs/assets/js/bootstrap.js", "./docs/assets/css/bootstrap.css"],

So there you go. Add {"bootstrap": "~2.3.2"} to your bower.json dependencies like you normally would, then use it like this:

<link href="bower_components/bootstrap/docs/assets/css/bootstrap.css" rel="stylesheet">
<script src="bower_components/bootstrap/docs/assets/js/bootstrap.js"></script>

No build step required.



来源:https://stackoverflow.com/questions/21376440/bower-installing-legacy-bootstrap-2-3-2-with-bower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!