3

I'm trying to extend the .card class from Bootstrap 4 by doing something like this on site.scss file:

@import "path/to/bootstrap4/bootstrap.scss";

.slider-card {
    @extend .card;
    //some CSS
}

When I compile this file everything from bootstrap gets copied to it. I understood that when @import is used the content that I'm importing gets copied, but I would like not to have this behavior.

Is there a way that I could compile both bootstrap and my file into two different output files?

If it makes any difference I'm trying using the command line and with a simple gulp task.

Thanks

tucaz
  • 6,524
  • 6
  • 37
  • 60
  • Why do you want to generate 2 different files? – cimmanon Mar 01 '16 at 03:51
  • @cimmanon I would like to have everything in its own file for "by page" use cases such as referencing only the necessary CSS in my pages. An example would be to include this .slider-card only in the pages it is used instead of it going to all other pages. Howerver, as I understood when using SASS everything gets compiled to ONE file and this unique file has everything and has to be served for every page even if not necessary. This doesn't looks like a good idea to me. Does it make sense? – tucaz Mar 01 '16 at 03:56
  • There is absolutely no benefit to splitting up your files this way. – cimmanon Mar 01 '16 at 03:59
  • Care to elaborate @cimmanon? Closing it like that seems a bit arbitrary. – tucaz Mar 01 '16 at 04:03
  • If your question is "not a duplicate", it is your job to elaborate as to **why** this is not a duplicate. – cimmanon Mar 01 '16 at 12:05
  • I don't have a problem with my question being answered somewhere else if it's a duplicate @cimmanon. What bothers me is you closing it and leaving a remark telling me that what I want to do is useless . Why don't you let me judge how useful it is myself? I'm not asking for advice, but how I can accomplish something using a tool, instead. This is as objective as any question can be. I don't judge other's people question and neither should you. – tucaz Mar 02 '16 at 03:43
  • My previous comment has nothing to do with why I closed it as a duplicate. I closed it because it was a duplicate of another question. You and 4 other non-experts inappropriately reopened it without providing any proof that this is not a duplicate in any way. – cimmanon Mar 02 '16 at 03:48
  • I don't see how this is a duplicate of the linked question. I also think cinnamon has no clue what he's talking about when he says that there's no reason to do this. Not having one big CSS file is essential to good single page architecture. I can elaborate if I really need to... – William Neely Feb 23 '17 at 22:05

0 Answers0