You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/zh/guide/pre-processors.md
+25-25Lines changed: 25 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -2,28 +2,28 @@
2
2
sidebarDepth: 2
3
3
---
4
4
5
-
# Using Pre-Processors
5
+
# 使用预处理器
6
6
7
-
In webpack, all pre-processors need to be applied with a corresponding loader. `vue-loader` allows you to use other webpack loaders to process a part of a Vue component. It will automatically infer the proper loaders to use based on the `lang`attribute of a language block and the rules in your webpack config.
Any content inside the block will be processed by webpack as if it's inside a `*.scss`file.
49
+
这个块里的任何内容都会被 webpack 当作在一个 `*.scss`文件中一样被处理。
50
50
51
51
### SASS vs SCSS
52
52
53
-
Note that `sass-loader`processes the non-indent-based `scss`syntax by default. In order to use the indent-based `sass`syntax, you need to pass options to the loader:
Configuration of PostCSS can be done via `postcss.config.js`or`postcss-loader`options. For details, consult [postcss-loader docs](https://github.com/postcss/postcss-loader).
Processing templates is a little different, because most webpack template loaders such as `pug-loader` return a template function instead of a compiled HTML string. Instead of using `pug-loader`, we need to use a loader that returns the raw HTML string instead, e.g. `pug-plain-loader`:
206
+
模板的处理会稍微有些不同,因为绝大对数 webpack 的模板类 loader,诸如 `pug-loader`,会返回一个模板函数而不是一个编译好的 HTML 字符串。所以我们需要使用一个返回原始的 HTML 字符串的 loader,例如 `pug-plain-loader`,而不是使用 `pug-loader`。
If you also intend to use it to import `.pug`files as HTML strings in JavaScript, you will need to chain `raw-loader` after the preprocessing loader. Note however adding `raw-loader`would break the usage in Vue components, so you need to have two rules, one of them targeting Vue files using a `resourceQuery`, the other one (fallback) targeting JavaScript imports:
0 commit comments