Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

💅 vue style loader module for webpack

License

NotificationsYou must be signed in to change notification settings

vuejs/vue-style-loader

 
 

Repository files navigation

This is a fork based onstyle-loader. Similar tostyle-loader, you can chain it aftercss-loader to dynamically inject CSS into the document as style tags. However, since this is included as a dependency and used by default invue-loader, in most cases you don't need to configure this loader yourself.

Options

  • manualInject (3.1.0+):

    Type:boolean. When importing the style from a non-vue-file, by default the style is injected as a side effect of the import. WhenmanualInject is true, the imported style object exposes a__inject__ method, which can then be called manually at appropriate timing. If called on the server, the method expects one argument which is thessrContext to attach styles to.

    importstylesfrom'styles.scss'exportdefault{beforeCreate(){// or create a mixin for this purposeif(styles.__inject__){styles.__inject__(this.$ssrContext)}}render(){return<divclass={styles.heading}>Hello World</div>}}

    Note this behavior is enabled automatically whenvue-style-loader is used on styles imported within a*.vue file. The option is only exposed for advanced usage.

  • ssrId (3.1.0+):

    Type:boolean. Adddata-vue-ssr-id attribute to injected<style> tags even when not in Node.js. This can be used with pre-rendering (instead of SSR) to avoid duplicate style injection on hydration.

Differences fromstyle-loader

Server-Side Rendering Support

When bundling withtarget: 'node', the styles in all rendered components are collected and exposed on the Vue render context object ascontext.styles, which you can simply inline into your markup's<head>. If you are building a Vue SSR app, you probably should use this loader for CSS imported from JavaScript files too.

Misc

  • Does not support url mode and reference counting mode. Also removedsingleton andinsertAt query options. It always automatically pick the style insertion mechanism that makes most sense. If you need these capabilities you should probably use the originalstyle-loader instead.

  • Fixed the issue that root-relative URLs are interpreted against chrome:// urls and make source map URLs work for injected<style> tags in Chrome.

License

MIT

About

💅 vue style loader module for webpack

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp