Breaking up common.scss into multiple files in components?
A discussion about the limitations of importing additional styles from common.scss in Discourse theme components. labofoz shares an issue where importing styles from common.scss results in an error. david and sam confirm that importing files within a theme is currently impossible but plans are underway to improve this.
julienbourdeau shares a similar issue and provides an error message. labofoz implements a temporary workaround using Webpack to compile scripts and SCSS into one file, which is then injected inline using a template file.
In an update, david announces that multi-file SCSS is now supported natively by the Discourse theme system, with plans to add similar functionality for JavaScript assets soon.
@david has this kind of stuff high on our list, we want theme devs to be able to split off scss files, split of js files to multiple .es6 files and so on.
Current structure is very limiting for ultra advanced usage.
Thanks guys! For now, my workaround was to use Webpack to compile all my scripts into one, and then inject that one script inline using this command inside of a template file:
I organized it in anticipation of making it work seamlessly with the Theme CLI (that’ll be ready in a week or so). My vision with this is to build some components with Vue/React locally and see them pop up live on the Theme Creator!