dva+antd写的一个react例子--服务器nginx 的配置
location ^~ /crm { rewrite ^/crm/(.*)(\.js|\.css|\.png|\.jpg|\.jpeg|\.gif|index\.php|robots\.txt)$ /$1$2 break; rewrite .* /index.html break; root /etc/nginx/static2/CIF_crm-frontend/dist/crm/; }
以上是nginx的配置
{ "entry": "src/index.js", "disableCSSModules": false, "cssModulesExclude": ["./src/global.less"], "publicPath": "/crm/", "outputPath": "./dist/crm", "hash": true, "theme": { "@primary-color": "#5c94d6", "@link-color": "#6e97c4", "@border-radius-base": "5px", "@font-size-base": "12px", "@line-height-base": "1.2", "@btn-padding-base": "10px 15px", "@btn-border-radius-base": "20px", "@btn-height-base": "auto", "@btn-font-size-lg": "14px", "@layout-body-background": "#f5f8fb", "@text-color": "#353f51", "@layout-sider-background": "#7b9cc6", "@layout-trigger-background": "#4c75b3", "@menu-dark-bg": "#7b9cc6", "@menu-dark-submenu-bg": "#7b9cc6", "@table-header-bg": "#fff", "@input-border-color": "#d5e3f6", "@border-color-base": "#d5e3f6" }, "autoprefixer": null, "proxy": { "/api": { "target": "http://jsonplaceholder.typicode.com/", "changeOrigin": true, "pathRewrite": { "^/api" : "" } }, "/clms/boss/returnOrder": { "target": "http://10.1.1.182:8091/mockjsdata/5", "changeOrigin": true, "secure": false } }, "extraBabelPlugins": [ "transform-runtime", ["import", { "libraryName": "antd", "style": true }] ], "env": { "development": { "extraBabelPlugins": [ "dva-hmr" ] } }, "xdllPlugin": { "exclude": [ "babel-runtime" ], "include": [ "dva/router", "dva/saga", "dva/fetch" ] } }
以上是.roadhogrc的配置
------------/^(?!.*\.(css|js)).*$/ 正则不包含的css或者js 的正则