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

feat(stylus): 添加stylus支持 #71

Merged
merged 1 commit into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions packages/ice-scripts/lib/config/setWebpackLoaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const CSS_LOADER = require.resolve('css-loader');
const LESS_LOADER = require.resolve('less-loader');
const POSTCSS_LOADER = require.resolve('postcss-loader');
const SASS_LOADER = require.resolve('sass-loader');
const STYLUS_LOADER = require.resolve('stylus-loader');
const CSS_HOT_LOADER = require.resolve('css-hot-loader');
const URL_LOADER = require.resolve('url-loader');

Expand Down Expand Up @@ -92,6 +93,7 @@ module.exports = (chainConfig, mode = 'development') => {
setExtraCSSLoader('css');
setExtraCSSLoader('scss', [['sass-loader', SASS_LOADER, {}]]);
setExtraCSSLoader('less', [['less-loader', LESS_LOADER, { sourceMap: true, javascriptEnabled: true }]]);
setExtraCSSLoader('styl', [['stylus-loader', STYLUS_LOADER, { preferPathResolver: 'webpack' }]]);

// assets loader
setAssetsLoader('woff2', /\.woff2?$/, { mimetype: 'application/font-woff' });
Expand All @@ -104,23 +106,23 @@ module.exports = (chainConfig, mode = 'development') => {
chainConfig.module.rule('jsx')
.test(/\.jsx?$/)
.exclude
.add(EXCLUDE_REGX)
.end()
.add(EXCLUDE_REGX)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块的缩进有一定层级的关系的表现,修改是编辑器自动处理的?

Copy link
Contributor Author

@fengxinming fengxinming Nov 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ClarkXia 我配置了保存自动格式化,现在哪还有谁去手动改代码格式。如果是这个原因合不了代码,那麻烦你按照我改动的地方手动添加一下。

.end()
.use('babel-loader')
.loader(BABEL_LOADER)
.options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true }));
.loader(BABEL_LOADER)
.options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true }));

// tsx loader
chainConfig.module.rule('tsx')
.test(/\.tsx?$/)
.exclude
.add(EXCLUDE_REGX)
.end()
.add(EXCLUDE_REGX)
.end()
.use('babel-loader')
.loader(BABEL_LOADER)
.options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true }))
.end()
.loader(BABEL_LOADER)
.options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true }))
.end()
.use('ts-loader')
.loader(TYPESCRIPT_LOADER)
.options({ transpileOnly: true });
.loader(TYPESCRIPT_LOADER)
.options({ transpileOnly: true });
};
2 changes: 2 additions & 0 deletions packages/ice-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
"regenerator-runtime": "^0.13.3",
"sass-loader": "^7.1.0",
"semver": "^6.1.1",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"ts-loader": "^5.3.3",
"typescript": "^3.3.3333",
"uglifyjs-webpack-plugin": "^1.3.0",
Expand Down