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

taro3 支持pug写法吗 #7750

Closed
yangthen opened this issue Sep 27, 2020 · 1 comment
Closed

taro3 支持pug写法吗 #7750

yangthen opened this issue Sep 27, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@yangthen
Copy link

yangthen commented Sep 27, 2020

这个特性解决了什么问题?

可以使用pug

这个 API 长什么样?

安装pug和pug-plain-loader,编译后被直接编译成了字符串,完全没有效果

直接在webpack配置中引入pug-plain-loader即可
@Riant
Copy link

Riant commented Sep 11, 2023

我使用的是 taro 3.6,具体说一下配置方式,希望让同样使用 pug 的同学少走一些弯路。

  1. 当然是安装 pugpug-plain-loader
  2. 编辑配置文件 /config/index.js,找到 webpackChain 配置块,加入如下调用:
    webpackChain(chain) {
      // ... 
      chain.merge({
        module: {
          rule: {
            pugloader: {
              test: /\.pug$/,
              use: [
                {
                  loader: 'pug-plain-loader',
                  options: {},
                },
              ],
            },
          },
        },
      })
    },

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

No branches or pull requests

2 participants