ericgio / react-bootstrap-typeahead

React typeahead with Bootstrap styling
http://ericgio.github.io/react-bootstrap-typeahead/
MIT License
1.01k stars 409 forks source link

Feature Request: Include SCSS files in build #486

Closed derwaldgeist closed 4 years ago

derwaldgeist commented 5 years ago

I'd like to customise the styles of this package and thus include the SCSS files into my build process. Unfortunately, only compiled CSS files are included. It would be great if the SCSS files would be there as well, just as in the bootstrap 4 package. I solved this via including the package as a git submodule, but this is not optimal, as I would like to control its version centrally via package.json.

It would also be cool if the SCSS were prepared for customisation, i.e. by using variables instead of fixed values. Also for this, the bootstrap 4 package is a good reference.

ericgio commented 5 years ago

Hi @derwaldgeist, thanks for your feature request. Can you please help me better understand how the library CSS is integrated into your project/build process and how you intend on customizing it?

Without knowing more, my instinct would be to recommend simply overriding the library's CSS with your own (S)CSS file. Alternatively, you could just copy the SCSS from the git repo and use that in your project instead of the styles included in the library. Either way, it seems like you're creating a new file with your own SCSS that isn't part of the library and therefore can't really be tracked/updated with npm, but maybe I'm misunderstanding something.

derwaldgeist commented 5 years ago

Hi @ericgio Thanks a lot for your fast response!

Yes, overriding CSS is of course possible, but not as elegant as including the SCSS files directly.

Here is how it works for Bootstrap (and other libraries):

So, the files will be imported like this:

@import "./path/to/my/own/variables";
@import "./path/to/bootstrap/bootstrap"; // which imports its own `_variables.scss`

To enable this, two things are required:

Hope my description is clear enough. If not, don't hesitate to reach out again :-)

ericgio commented 5 years ago

Thanks @derwaldgeist for the detailed description! This doesn't seem like something I'll be able to get to very soon, but I'd be happy to accept a PR for the change if you're up for it.

ericgio commented 4 years ago

As of v4.0.0-rc.2 I've included the bare .scss files with the package (in the /css dir along with the previously available styles). The files are still specifying values directly rather than using variables, so not sure how helpful they'll be for the use case described above. If anyone wants to help move this issue forward by submitting a pull request, I'd welcome that.

ericgio commented 4 years ago

v5 of the library replaces some values in the SCSS file with variables. I'm going to consider this issue resolved. If anyone has specific ideas regarding how the SCSS should be structured and package, feel free to comment or submit a PR with improvements.