Search code examples
twitter-bootstrapmeteorlesspackage-development

How to re-use bootstrap's LESS variables in a meteor package


I am making a package that provides some additionnal ui components for bootstrap. I chose to depend on the (awesome) nemo64:bootstrap package for the LESS bootstrap library.

My package has to provide additional LESS files that would require some of the bootstrap LESS variables (say @brand-success). The end user could very well have customized those variables.

The nemo64:bootstrap package provide a file (custom.bootstrap.import.less) with bootstrap variables for the user to include it where needed. It is also the place where the user is expected to customize its bootstrap. So I'd like to include this in my package's less file, but I don't know, from my package, where the end user will put this file.

I could assume the default path that is given has an example on the nemo64:bootstrap package documentation (/client/lib/custom.bootstrap.import.less) but if another package writer make a different choice, the packages will be incompatible.

Is there a way not to enforce a specific file architecture to end-users ?


Solution

  • One solution is to export the LESS file as an asset on the server and have a build plugin that will copy the file in the app so that the user can @import it wherever needed.

    This is done the same way nemo64:bootstrap does it, which is a bit hacky and require to split the package in two different packages. I explained everything in this gist