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

feat(build): add lazy styles/scripts #3402

Merged
merged 3 commits into from
Dec 9, 2016

Conversation

filipesilva
Copy link
Contributor

Close #3401
Close #3400

@filipesilva filipesilva self-assigned this Dec 5, 2016
@filipesilva filipesilva changed the title [WIP] add lazy styles [WIP] feat(build): add lazy styles/scripts Dec 5, 2016
@filipesilva filipesilva force-pushed the add-lazy-styles branch 2 times, most recently from 009213a to fddd2cf Compare December 5, 2016 17:13
@filipesilva filipesilva force-pushed the add-lazy-styles branch 18 times, most recently from bde0363 to 8bbf31e Compare December 6, 2016 20:01
@filipesilva filipesilva changed the title [WIP] feat(build): add lazy styles/scripts feat(build): add lazy styles/scripts Dec 6, 2016
]
}
plugins: [
new ExtractTextPlugin({filename: '[name].bundle.css'})
Copy link
Member

Choose a reason for hiding this comment

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

I think the javascript bundle is needed for HMR support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There seems to be ways of using it with extracted css: webpack-contrib/extract-text-webpack-plugin#30 (comment)

I also want to note that CSS is only extracted for global styles.

Copy link
Member

Choose a reason for hiding this comment

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

OK. Always extracting is definitely cleaner just didn't know about the HMR workaround.

@@ -73,7 +50,8 @@ export const getWebpackProdConfigPartial = function(projectRoot: string,
new webpack.LoaderOptionsPlugin({
Copy link
Member

@clydin clydin Dec 7, 2016

Choose a reason for hiding this comment

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

This will replace the options from the common config. webpack-merge doesn't handle it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that, will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. had to duplicate the config into prod though, didn't find a better way.


// load global scripts using script-loader
extraRules.push({
include: globalScrips.map((script) => script.path), test: /\.js$/, loader: 'script-loader'
Copy link
Member

Choose a reason for hiding this comment

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

AOT removes the need for eval but script-loader brings it back. Probably not something that should be addressed in this PR but I think it's important to note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We always had script-loader for global scripts though, I merely added it conditionally instead of always having it.

Copy link
Member

Choose a reason for hiding this comment

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

I agree; no current action is needed. I was just thinking maybe a future TODO or some additional future documentation (post-1.0) might be useful (probably on CSP in general).

@grizzm0
Copy link
Contributor

grizzm0 commented Dec 7, 2016

Your autoprefixer changes is already fixed in #3164

@filipesilva filipesilva force-pushed the add-lazy-styles branch 2 times, most recently from 4167c77 to 3b78e69 Compare December 7, 2016 16:31
@filipesilva
Copy link
Contributor Author

@grizzm0 you're right, and I have been late to merge it. I'll get it in and rebase mine on yours.

@hansl
Copy link
Contributor

hansl commented Dec 9, 2016

LGTM. Just need to rebase. cheers!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support lazy loaded and custom named scripts/styles Support union types in angular-cli.json
5 participants