Are there drawbacks to not including preprocessed CSS in the app-bundle?

97 views Asked by At

I'm thinking about changing the processCSS gulp task that Aurelia CLI creates to create physical css files, instead of including it directly in the app-bundle.

Are there any major drawbacks within the Aurelia framework to doing this?

I'm more comfortable with separate css files after preprocessing, but I don't want to do it if I'd be missing out on some performance benefits, or create other troubles down the road.

1

There are 1 answers

1
Joseph Gabriel On BEST ANSWER

I don't think there's any major drawback that can't be reasonably overcome. However, I would try to evaluate the benefit of doing it your way, instead of bundling it together.

I'll list a couple of points I can think of, in no particular order.

  • It can be challenging to get the modules and paths set up correctly if you are requiring CSS from standalone CSS modules. If you are using plain CSS files, then you will need to included and maintain the Link tags in your host HTML page. All this is easier if the CSS is bundled directly into the app bundle. Especially when adding more CSS due to 3rd party libraries etc.
  • if you are using the organizational pattern where you create css-per-component instead of having one monolithic CSS file, then there are potential performance impacts to making http requests for each individual css file, although the impact is probably more thoeretical than practical.
  • when deploying, it is really nice to just deploy a minimum number of files.
  • when all css is bundled, you can add comments at top of each CSS source file to help identify the source file when looking at the CSS in the browser inspector.

One last thing, it may be worth your time to experiment loading the CSS in different ways, including as individual files and see which way works best for your environment.