From 117c5d982b1c8746caa8689d1c5cc8c71967cfb4 Mon Sep 17 00:00:00 2001 From: Danny <37711786+danny-andrews-snap@users.noreply.github.com> Date: Fri, 28 Sep 2018 16:12:23 -0500 Subject: [PATCH 1/2] Add example of @import'ing a node module The syntax for importing a node_module is not easy to find (see https://github.com/webpack/webpack/issues/1789#issuecomment-277024235). Maybe this will help a few people out. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d0b8f631..130a58d5 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ To disable `@import` resolving by `css-loader` set the option to `false` ```css @import url('https://fonts.googleapis.com/css?family=Roboto'); +@import '~module/styles.css'; ``` > _⚠️ Use with caution, since this disables resolving for **all** `@import`s, including css modules `composes: xxx from 'path/to/file.css'` feature._ From 3d09f8386af0b1468916408f18e5ed6a8b37f4f3 Mon Sep 17 00:00:00 2001 From: Danny <37711786+danny-andrews-snap@users.noreply.github.com> Date: Fri, 28 Sep 2018 16:53:22 -0500 Subject: [PATCH 2/2] Incorporate PR Suggestions --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 130a58d5..aa46592f 100644 --- a/README.md +++ b/README.md @@ -115,11 +115,16 @@ url(~module/image.png) => require('module/image.png') ### `import` +To import styles from a node module path, prefix it with a `~`: + +```css +@import '~module/styles.css'; +``` + To disable `@import` resolving by `css-loader` set the option to `false` ```css @import url('https://fonts.googleapis.com/css?family=Roboto'); -@import '~module/styles.css'; ``` > _⚠️ Use with caution, since this disables resolving for **all** `@import`s, including css modules `composes: xxx from 'path/to/file.css'` feature._