日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

h5有缓存css,taro H5配置 cdn css js 缓存 hash 配置

發布時間:2023/11/27 生活经验 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 h5有缓存css,taro H5配置 cdn css js 缓存 hash 配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.taro使用詳情請參考本https://nervjs.github.io/taro/docs搭建

2.關于文件的配置,在config/index.js添加相關配置

使得pages下面對應的文件夾可以使用對應的文件名而不是index.js,例如home.js

使得src下面的文件引用可以采用'@utils/jump'的引用方式(包括action,reducer,utils,styles等文件夾下的文件引用)

const path = require('path')

const sassImportor = function(url) {

const reg = /^@styles\/(.*)/

return {

file: reg.test(url) ? path.resolve(__dirname, '..', 'src/styles', url.match(reg)[1]) : url

}

}

const config = {

projectName: 'gant-taro',

date: '2019-2-26',

designWidth: 750,

deviceRatio: {

'640': 2.34 / 2,

'750': 1,

'828': 1.81 / 2

},

sourceRoot: 'src',

outputRoot: 'dist',

plugins: {

babel: {

sourceMap: true,

presets: [

['env', {

modules: false

}]

],

plugins: [

'transform-decorators-legacy',

'transform-class-properties',

'transform-object-rest-spread'

]

},

sass: {

importer: sassImportor

}

},

defineConstants: {

},

alias: {

'@actions': path.resolve(__dirname, '..', 'src/actions'),

'@assets': path.resolve(__dirname, '..', 'src/assets'),

'@components': path.resolve(__dirname, '..', 'src/components'),

'@constants': path.resolve(__dirname, '..', 'src/constants'),

'@reducers': path.resolve(__dirname, '..', 'src/reducers'),

'@styles': path.resolve(__dirname, '..', 'src/styles'),

'@utils': path.resolve(__dirname, '..', 'src/utils')

},

copy: {

patterns: [

],

options: {

}

},

weapp: {

module: {

postcss: {

autoprefixer: {

enable: true,

config: {

browsers: [

'last 3 versions',

'Android >= 4.1',

'ios >= 8'

]

}

},

pxtransform: {

enable: true,

config: {

}

},

url: {

enable: true,

config: {

limit: 10240 // 設定轉換尺寸上限

}

},

cssModules: {

enable: false, // 默認為 false,如需使用 css modules 功能,則設為 true

config: {

namingPattern: 'module', // 轉換模式,取值為 global/module

generateScopedName: '[name]__[local]___[hash:base64:5]'

}

}

}

}

},

h5: {

publicPath: '/',

staticDirectory: 'static',

output: {

filename: 'js/[name].[hash].js',

chunkFilename: 'js/[name].[chunkhash].js'

},

imageUrlLoaderOption: {

limit: 5000,

name: 'static/images/[name].[hash].[ext]'

},

miniCssExtractPluginOption: {

filename: 'css/[name].[hash].css',

chunkFilename: 'css/[name].[chunkhash].css',

},

module: {

postcss: {

autoprefixer: {

enable: true,

config: {

browsers: [

'last 3 versions',

'Android >= 4.1',

'ios >= 8'

]

}

},

cssModules: {

enable: false, // 默認為 false,如需使用 css modules 功能,則設為 true

config: {

namingPattern: 'module', // 轉換模式,取值為 global/module

generateScopedName: '[name]__[local]___[hash:base64:5]'

}

}

}

},

sassLoaderOption: {

importer: sassImportor

}

}

}

module.exports = function (merge) {

if (process.env.NODE_ENV === 'development') {

return merge({}, config, require('./dev'))

}

return merge({}, config, require('./prod'))

}

3.由于antd只以h5和rn為端應用,taro面向的還有微信 支付寶 頭條等等 ,所以說taro提供了taro-ui這個統一框架

詳情請參考https://taro-ui.aotu.io/#/docs/introduction

作者:有風吹是幸福的

鏈接:https://www.jianshu.com/p/cbd78616c0a9

來源:簡書

簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權并注明出處。

總結

以上是生活随笔為你收集整理的h5有缓存css,taro H5配置 cdn css js 缓存 hash 配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。