-
Notifications
You must be signed in to change notification settings - Fork 602
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
Reduce theme bundle size by using specific minified libraries #1037
Conversation
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.
@sacr3dc0w this is amazing. Thanks for all the work on cornerstone theme. Can you please add a change log entry ?
@junedkazi are you comfortable with one of us merging this as it now has a changelog entry? |
@PreciselyAlyss we plan on cutting a new release today. So will merge it after that is done. Since we don't want to add any new scopes to the testing effort which is based on the current master. |
@@ -1,5 +1,5 @@ | |||
import $ from 'jquery'; | |||
import 'slick-carousel/slick/slick'; | |||
import 'slick-carousel/slick/slick.min'; |
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.
@sacr3dc0w - this is great! can we put them in the webpack.conf.js
resolve instead:
resolve: {
alias: {
html5-history-api: path.resolve(__dirname, 'node_modules/html5-history-api/history.min'),
jquery: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.js'),
jstree: path.resolve(__dirname, 'node_modules/jstree/dist/jstree.min.js'),
slick-carousel: path.resolve(__dirname, 'node_modules/slick-carousel/slick/slick.min'),
},
},
that way the imports can simply be:
import 'slick-carousel';
...
import 'html5-history-api'
seeing as this was already merged, feel free to open another PR
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.
@sacr3dc0w i'll just go ahead and create a quick pr
What?
In an effort to reduce the size of the theme bundle, I've pointed two libraries to their minified versions.
Screenshots (if appropriate)
Bundle, before history.min.js
Bundle, after history.min.js
Bundle, before slick.min.js
Bundle, after slick.min.js
Bundle, after both history.min.js and slick.min.js