Comments (4)
It's not agreed upon, but I think foundation gets it right:
- Separate distribution repository, so you don't need to put compiled files in source repo, and packaged .zip by github doesn't contain unnecessary files, like docs.
main
contains just two files: precompiled and concatenated css / js (usable default)- Distribution repo contains also source assets, so if developer is concerned about the size of resulting javascript bundle, he/she can override
main
and pick individual javascript files (or source scss files) - They don't include fonts, images, etc. in
main
.
So I think it's best if:
- Main contains only one, useful entry point for js + one useful entry point for css (precompiled).
- No other files in
main
, like .less, .coffee, .scss, fonts, images, etc. - Provide also source files so developers can customize by overriding
main
.
Also, I think each file in main
should be requirable on its own, so no files without wrapping UJS snippet.
Specifying consisting parts of Bootstrap makes it much easier to programmatically fetch them, filter out what I don't need and compile the rest.
I think better approach is to select files you need, not filter out what you don't.
I suggest naming them individually. This is the way it's done in bootstrap-sass.
Bootstrap-sass seems improper bower component anyway. It uses custom load path instead relative paths. Bower unfortunately doesn't allow for defining load paths for precompilers (maybe it's a good feature request? I think defining load paths is less ambiguous than "main" files).
I guess it's ok for javascript libraries to include multiple files in main, but just because each file can be required individually, and maybe author doesn't want to put distribution files in the repository.
Bootstrap's javascripts are a library, but bootstrap already includes concatenated javascripts in repository, so it's easier and more clear to just put one js
in main instead 20.
All to all, I think main
is just a useful default, and in our case it should contain only two files (js + css), because two files are the simplest thing to include to make bootstrap work on a website. KISS :)
Does it answer your question?
from spec.
On second thought maybe including main .less
in bower.json
is not that bad idea, because it's hard to guess load path for less
files without main file. I think my stance on main
is as follows:
Each entry of main
should define both load path and main asset of that load path.
So for example
{
"main": ["dist/js/foobar.js", "dist/css/foobar.css", "dist/less/foobar.less"]
}
Defines three load paths:
dist/js
forjs
compiler (browser, browserify etc.)dist/less
for less compilerdist/css
for css compiler (browser, grunt, jspm, ...)
And three main files for each compiler:
foobar.js
forjs
compilerfoobar.less
for less compilerfoobar.css
for css compiler
The only two required paths by bower would be for js
and css
compilers.
... but only until main
is deprecated and replaced by something more sound.
from spec.
On second thought maybe including main
.less
inbower.json
is not that bad idea
Yeah, it's become some level of de facto standard; see links+discussion in twbs/bootstrap#13328.
... but only until
main
is deprecated and replaced by something more sound.
That'll take a year at Bower's current rate.
from spec.
TL;DR:
main
isn't going anywhere any time soonmain
is de facto an array; normally it should have only one file per asset type
from spec.
Related Issues (20)
- bower validate? HOT 1
- "overrides" property proposal HOT 3
- Proposal for an optional "supportedVersions" property HOT 2
- main and ignore are optional, but bower complains if missing HOT 1
- How should local components be specified and consumed to avoid duplication? HOT 1
- files: list all required files for build tools HOT 71
- Version the spec itself HOT 5
- Add the possibility to host custom fields in the bower.json HOT 5
- Rename repository to bower-spec and add .bowerrc specificaton HOT 5
- dependencies and devDependencies automatically pull the latest commit when url has #latest suffix ? HOT 1
- Inconsistencies for version, main, ignore attributes HOT 1
- Formatting of Deprecated is Confusing HOT 1
- example of environment variables seems incorrect HOT 2
- config spec does not document hooks HOT 1
- main property for es6 module version HOT 1
- Author clarification
- save and save-exact aren't listed in the spec
- Concurrent bower install error.
- Default value of `private` field is not specified. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spec.