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

[POC] Support theme-based styles in SFCs #6823

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

sharkykh
Copy link
Contributor

@sharkykh sharkykh commented Jun 12, 2019

  • Change cssThemes to an array
  • Update Gulpfile
  • Split Webpack configurations
  • Add support for theme-based styles in SFCs

It slows down the build by 40-50%.
Opening this PR as a Proof-of-Concept only at the moment.

Update:

  • Add babel-loader and vue-loader caching (development builds only)
  • Hide stats behind a flag (yarn [dev|build] --env.stats to show)
  • Switch to ExtractCssChunks
  • Use Theme class instead of separate functions
  • Replace oneOf with use()
  • module.noParse jQuery (because it doesn't have any imports)

@sharkykh sharkykh force-pushed the feature/split-webpack-builds branch from 4a9f712 to 957254e Compare June 13, 2019 18:27
@sharkykh
Copy link
Contributor Author

sharkykh commented Jun 13, 2019

Something to keep in mind:
With this configuration, we can choose which theme to build.
https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations

If you pass a name to --config-name flag, webpack will only build that specific configuration.

For our use case:
yarn [dev|build] --config-name [dark|light] [--watch]

So for example, if our Medusa is running the dark theme, we don't need to build the light theme every time we make a change. We can instead run yarn dev --config-name dark to only build the dark theme.

At this point, it's probably a good idea to add shortcuts for these,
in the form of yarn dev:dark and yarn dev:light.

Before committing you will still be required to run either the full build with yarn dev, or just build the other theme (so if you worked on dark, run yarn dev:light)

@sharkykh sharkykh mentioned this pull request Jun 29, 2019
@medariox medariox modified the milestones: 1.0.0, 1.0.1, 1.0.2, 1.0.3 May 31, 2022
@medariox medariox modified the milestones: 1.0.3, 1.0.4 Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants