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

nuxt 如何打包 css #113

Open
dailynodejs opened this issue Dec 20, 2021 · 1 comment
Open

nuxt 如何打包 css #113

dailynodejs opened this issue Dec 20, 2021 · 1 comment

Comments

@dailynodejs
Copy link
Collaborator

dailynodejs commented Dec 20, 2021

配置 extractCSS

https://github.com/nuxt/nuxt.js/blob/2.x/packages/config/src/config/build.js#L7

默认 false

extractCSS: false,
filenames: {
  css: ({isDev} =>  isDev ?  '[name].css' :  'css/[contenthash:7].css' })
}
@dailynodejs
Copy link
Collaborator Author

dailynodejs commented Dec 28, 2021

extract-css-chunks-webpack-plugin

地址:https://www.npmjs.com/package/extract-css-chunks-webpack-plugin

开发环境:

plugins [
  TimeFixPlugin { watchOffset: 11000 },
  ExtractCssChunksPlugin {
    options: {
      filename: '[name].css',
      moduleFilename: [Function: moduleFilename],
      ignoreOrder: false,
      chunkFilename: '[name].css',
      insert: null
    }
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant