【问题标题】:How to create a react and stylus compiler?如何创建一个反应和手写笔编译器?
【发布时间】:2017-07-14 09:59:39
【问题描述】:

现在我正在尝试使用 npm 和 gulp 创建上述编译器。但我一直卡住。 我只需要它来编译 jsx 和 stylus 文件以在 localhost 服务器上运行。

【问题讨论】:

  • 这不是“创建[ing] 编译器”,它与compiler-construction 没有任何关系。没有什么比编写一个简单的 shell 脚本更复杂了。

标签: reactjs npm stylus gulp-stylus


【解决方案1】:

在你的 webpack 配置中,为 jsx 和 stylus 添加加载器,如下代码所示。

对于 JSX 和触控笔:

module: {
    loaders: [
      {
        test: /.jsx?$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
        query: {
          presets: ['es2015', 'react']
        }
      },
      {
        test: /\.styl$/,
        loader: 'css-loader!stylus-relative-loader?paths=node_modules/bootstrap-stylus/stylus/'
      }
    ]
  },

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-11
    相关资源
    最近更新 更多