tyler-johnson / bootstrap-package-manager

A simple command line interface for installing and compiling Twitter Bootstrap.
MIT License
8 stars 0 forks source link

Exclude bootstrap components, use local file #1

Open ghost opened 11 years ago

ghost commented 11 years ago

Would it be possible to exclude certain boostrap components on build? Giving people ways to reduce dead code weight is always a bonus.

Also, the addition of a command line option to use a local tarball (--bootstrap-file /path/to/tar.gz --font-awesome-file /path/to/font-awesome.tar.gz) would be a great help while developing a bootswatch.less file without re-downloading every time I want to see the changes live.

Anyway, thank you for a very nice module. bpm is great for reducing the complexity of a bootstrap build.

tyler-johnson commented 11 years ago

What were you hoping to exclude? BPM isn't ultra specific, but it allows you to specify the major components you want to include (less, js, css, images, and fonts). Are you wanting to whitelist/blacklist specific javascript files?

I agree that re-downloading the parts every time is a pain. I think your solution is an excellent one for the short term, however long-term I'd like to see those archives get stored somewhere locally so the user doesn't have to fuss with extra files. I'll implement your solution soon.

ghost commented 11 years ago

Storing the file locally is a good idea, but choosing a default location is tricky. I'd propose that if the file-location argument is provided but no file found, download the file and save it there. So --bootstrap-file /file/doesnt/exist.tar.gz would end up saving the bootstrap source at exist.tar.gz.

On http://twitter.github.io/bootstrap/customize.html, you can choose which components you want to include in a build more specifically. I haven't been able to find documentation on how this is accomplished - the official build script doesn't seem to support it, but I think BPM could without too much work.

All you really need to do to exclude a CSS component is (I think) comment out the @include line in bootstrap.less, and excluding a javascript element is a matter of just not concating the .js file it in.

tyler-johnson commented 11 years ago

I agree, if the file isn't found, it would instead download it there. Maybe the same should happen by default when it is downloaded into the dump folder? On clean up, the original archive isn't deleted and instead can be reused in subsequent BPM calls. This could be especially useful when needing to rerun it several times in a row without needing to download it from the source.

I see what you mean by customization. It is fairly simple from an implementation stand point, but how do you propose the user actually selects/deselects individual components? I see a few options:

  1. Two flags, --include and --exclude, which takes a comma separated value of css/js components to include or exclude. The only potential problem I see with this is a cluttered command since there are a lot of different components.
  2. A flag that sets a path to a JSON(?) file that specifies the components to include on build.
  3. An API specifically made for choosing components that implements with the existing --script flag.