Skip to content

Commit

Permalink
fix(cli): 支持根据文件后缀选择 css 预处理器
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jun 18, 2018
1 parent 3596172 commit 7d04c77
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
9 changes: 6 additions & 3 deletions packages/taro-cli/src/util/index.js
Expand Up @@ -48,14 +48,14 @@ const processTypeMap = {

exports.pocessTypeEnum = pocessTypeEnum

exports.CSS_EXT = ['.css', '.scss']
exports.CSS_EXT = ['.css', '.scss', '.sass', '.less', '.styl']
exports.SCSS_EXT = ['.scss']
exports.JS_EXT = ['.js', '.jsx']
exports.TS_EXT = ['.ts', '.tsx']
exports.REG_JS = /\.js(\?.*)?$/
exports.REG_SCRIPT = /\.(js|jsx)(\?.*)?$/
exports.REG_TYPESCRIPT = /\.(tsx|ts)(\?.*)?$/
exports.REG_STYLE = /\.(css|scss)(\?.*)?$/
exports.REG_STYLE = /\.(css|scss|sass|less|styl)(\?.*)?$/
exports.REG_MEDIA = /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/
exports.REG_IMAGE = /\.(png|jpe?g|gif|bpm|svg)(\?.*)?$/
exports.REG_FONT = /\.(woff2?|eot|ttf|otf)(\?.*)?$/
Expand All @@ -77,7 +77,10 @@ exports.DEVICE_RATIO = {

exports.FILE_PROCESSOR_MAP = {
'.js': 'babel',
'.scss': 'sass'
'.scss': 'sass',
'.sass': 'sass',
'.less': 'less',
'.styl': 'stylus'
}

exports.isNpmPkg = function (name) {
Expand Down
56 changes: 27 additions & 29 deletions packages/taro-cli/templates/default/config/index
Expand Up @@ -16,35 +16,33 @@ const config = {
'transform-object-rest-spread'
]
},
typescript: {
{
compilerOptions: {
allowSyntheticDefaultImports: true,
baseUrl: '.',
declaration: false,
experimentalDecorators: true,
jsx: 'react',
jsxFactory: 'Nerv.createElement',
module: 'commonjs',
moduleResolution: 'node',
noImplicitAny: false,
noUnusedLocals: true,
outDir: './dist/',
preserveConstEnums: true,
removeComments: false,
rootDir: '.',
sourceMap: true,
strictNullChecks: true,
target: es6
},
include: [
'src/**/*'
],
exclude: [
'node_modules'
],
compileOnSave: false
}
typescript: typescript: {
compilerOptions: {
allowSyntheticDefaultImports: true,
baseUrl: '.',
declaration: false,
experimentalDecorators: true,
jsx: 'react',
jsxFactory: 'Nerv.createElement',
module: 'commonjs',
moduleResolution: 'node',
noImplicitAny: false,
noUnusedLocals: true,
outDir: './dist/',
preserveConstEnums: true,
removeComments: false,
rootDir: '.',
sourceMap: true,
strictNullChecks: true,
target: 'es6'
},
include: [
'src/**/*'
],
exclude: [
'node_modules'
],
compileOnSave: false
}
},
defineConstants: {
Expand Down

0 comments on commit 7d04c77

Please sign in to comment.