Skip to content
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

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

hugopeek
Copy link
Contributor

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:

{
    "components": [
        ...
    ],
    "individuals": [
        form,
        modal,
        step
    ]
}

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.

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.
@lubber-de lubber-de added state/awaiting-triage Any issues or pull requests which haven't yet been triaged type/build Anything related to the build process type/feat Any feature requests or improvements state/awaiting-reviews Pull requests which are waiting for reviews and removed state/awaiting-triage Any issues or pull requests which haven't yet been triaged labels Mar 30, 2020
@exoego
Copy link
Contributor

exoego commented Mar 30, 2020

Thanks for opening this feature request.
I was thinking this idea too.

My use-case is for emoji and icon modules: those 2 modules are quite huge, so I want to use them as separate CSS/JS file only when needed.

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lubber-de
Copy link
Member

lubber-de commented Mar 30, 2020

@hugopeek Would you like to adjust the Docs accordingly here: https://fomantic-ui.com/introduction/build-tools.html#semanticjson ? 🙂

@lubber-de lubber-de added the state/awaiting-docs Pull requests which need doc changes/additions label Mar 30, 2020
@lubber-de lubber-de added this to the 2.8.5 milestone Mar 30, 2020
@hugopeek
Copy link
Contributor Author

@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 ;)

@lubber-de
Copy link
Member

@lubber-de Sure, done :)

Thanks 😎 Please see my comment fomantic/Fomantic-UI-Docs#203 (comment)

hugopeek added a commit to hugopeek/romanesco-soil that referenced this pull request Mar 30, 2020
…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
@lubber-de lubber-de added state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo and removed state/awaiting-docs Pull requests which need doc changes/additions labels Mar 31, 2020
Copy link
Contributor

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@lubber-de lubber-de merged commit 9b1f9ef into fomantic:develop Apr 7, 2020
@lubber-de lubber-de removed the state/awaiting-reviews Pull requests which are waiting for reviews label Apr 7, 2020
@hugopeek
Copy link
Contributor Author

hugopeek commented Apr 9, 2020

@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?

@exoego
Copy link
Contributor

exoego commented Apr 9, 2020

@hugopeek
Don't worry, this feature is not published yet in stable version.

Shall I make a new PR with the fix later?

Ofcourse !!
I am looking forward to use this feature for my projects.

@hugopeek
Copy link
Contributor Author

hugopeek commented Apr 9, 2020

PR #1408 fixes the issues with gulp watch..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo type/build Anything related to the build process type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants