Skip to content

Commit

Permalink
fix wemark
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghongtu committed Feb 10, 2023
1 parent bca4a37 commit c3ad7aa
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 343 deletions.
160 changes: 87 additions & 73 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,101 @@
const path = require('path');

const config = {
projectName: 'GitHub-Pro',
date: '2023-2-7',
projectName: 'GitHub-Pro',
date: '2023-2-7',
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
alias: {
'@': path.resolve(__dirname, '..', 'src'),
},
copy: {
patterns: [],
options: {},
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
sass: {
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
alias: {
'@': path.resolve(__dirname, '..', 'src'),
},
copy: {
patterns: [
{
from: 'src/wemark',
to: 'dist/wemark'
}
],
options: {
}
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},

sass: {
resource: [path.resolve(__dirname, "..", "src/style/variables.scss")],
// data: `@import "taro-ui/dist/style/variables/default.scss";`,
},
mini: {
miniCssExtractPluginOption: {
ignoreOrder: true,
},
postcss: {
pxtransform: {
enable: true,
config: {
},
},
url: {
enable: true,
config: {
limit: 1024, // 设定转换尺寸上限
},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
h5: {
publicPath: '/',
staticDirectory: 'static',
// esnextModules: ['nutui-react'],
postcss: {
pxtransform: {
enable: true,
config: {
},
},
autoprefixer: {
enable: true,
config: {},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
// data: `@import "taro-ui/dist/style/variables/default.scss";`,
},
weapp: {
compile: {
exclude: [
'src/wemark/remarkable.js',
]
}
},
mini: {
miniCssExtractPluginOption: {
ignoreOrder: true,
},
postcss: {
pxtransform: {
enable: true,
config: {
},
},
url: {
enable: true,
config: {
limit: 1024, // 设定转换尺寸上限
},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[hash:base64:6]',
},
},
},
},
h5: {
publicPath: '/',
staticDirectory: 'static',
// esnextModules: ['nutui-react'],
postcss: {
pxtransform: {
enable: true,
config: {
},
},
autoprefixer: {
enable: true,
config: {},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
};

module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'));
}
return merge({}, config, require('./prod'));
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'));
}
return merge({}, config, require('./prod'));
};
3 changes: 3 additions & 0 deletions src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,7 @@ export default defineAppConfig({
},
],
},
usingComponents: {
wemark: './wemark/wemark',
},
});
6 changes: 0 additions & 6 deletions src/components/markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,4 @@ const Markdown = ({ md: rawMD, full_name }: MarkDownProps) => {
);
};

Markdown.config = {
usingComponents: {
wemark: '../../wemark/wemark',
},
};

export default Markdown;
Loading

0 comments on commit c3ad7aa

Please sign in to comment.