-
-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Build] Allow individual components to be defined in config #1385
[Build] Allow individual components to be defined in config #1385
Conversation
Individual components will have their .css/.js file generated under /dist/components, but are not included in semantic.css and semantic.js. This is useful for including components in your project only if you need them, while keeping the file size of the main .css/.js file down. To accomplish this, simply add a new array to your semantic.json: ``` "individuals": [ form, modal, step ] ``` Don't forget to remove these items from the "components" array. This change should be fully backwards compatible. It only changes the src variable if an "individuals" array has been defined in the config.
Thanks for opening this feature request. My use-case is for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@hugopeek Would you like to adjust the Docs accordingly here: https://fomantic-ui.com/introduction/build-tools.html#semanticjson ? 🙂 |
@lubber-de Sure, done :) @exoego Yeah exactly, I was going back and forth with adding them to semantic.json, building, then removing them again and then building again to keep the file size down.. And now semantic.css hit 1MB in a project, so time to act! It's not a silver bullet solution btw. Some components depend on each other, so you can't just take them out of the main files without disabling some functionality. But that's for another day ;) |
Thanks 😎 Please see my comment fomantic/Fomantic-UI-Docs#203 (comment) |
…CSS/JS You can now remove the 'form', 'calendar', 'modal' and 'step' components from semantic.json in existing projects. They are still generated as individual components, but no longer added to semantic.css and semantic.js. This relies on customizations in the Fomantic UI build process, which are submitted as PR here: fomantic/Fomantic-UI#1385
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@lubber-de @exoego Thanks for merging guys. I found a small glitch however: the gulp watch task is no longer updating only the files that changed.. It goes through the whole list now. I'm looking at how to correct this now. Shall I make a new PR with the fix later? |
@hugopeek
Ofcourse !! |
PR #1408 fixes the issues with gulp watch.. |
Description
Individual components will have their .css/.js file generated under /dist/components, but are not included in semantic.css and semantic.js.
This is useful for including these components in your project only if you need them, while keeping the file size of the main .css/.js file as small as possible.
Testcase
To make it work, create a new array in your semantic.json:
Don't forget to remove these items from the regular "components" array.
This change should be fully backwards compatible. It only changes the src variable if an "individuals" array has been defined in the config.