webstorm 中tailwindcss没有智能提示、功能不全
能用,但不完全能用
用到postcss、tailwindcss等工具,这些我也是第一次用,目前已经到了可以用,但又不完全用的状态,在tailwind中大部分的可以用,但一些用不了,我也不知道为什么,尽力了。
没有智能提示
按照官网可以,自己的缺不可以
第二就是,没有智能提示,就很诡异,按照官网的提示,用vite创建一个项目可以智能提示
https://tailwindcss.com/docs/guides/vite
按照官网的步骤是可以的,设置分别为
//tailwind.config.js
module.exports = {
content: [
"./index.html",
"./src/**/*.{vue,js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
//postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
看到这了我就用一样的方法加进去。
然后遇到一个问题,公司的工具不支持autoprefixer 8.x,就用了tailwin的兼容版
https://www.tailwindcss.cn/docs/installation#post-css-7
然后都做完了,可以显示,但是没有智能提示
尽力了尽力了。。。改不动了,网上查也没有能用的资料
//vue.config.js
'use strict'
const path = require('path')
function resolve(dir) {
return path.join(__dirname, dir)
}
let target = 'https://test.dongguantong.com.cn'
if (process.env.VUE_APP_MODE === "online") {
target = 'https://h5.dongguantong.com.cn'
}
const webpack = require('webpack')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
module.exports = {
publicPath: './',
lintOnSave: false,
productionSourceMap: false,
css: {
loaderOptions: {
postcss: {
plugins: [
// 补全css前缀(解决兼容性)
require('autoprefixer')(),
require('postcss-pxtorem')({ // px to rem
rootValue: 37.5, // 换算的基数
selectorBlackList: [], // 忽略转换正则匹配项
propList: ['*']
}),
require('tailwindcss'),
// require('autoprefixer'),
]
}
}
},
devServer: { // 包含关系
proxy: {
'/openapi': {
target: 'http://www.dongguantong.com.cn:8900',
changeOrigin: true
},
}
},
configureWebpack: {
resolve: {
// 自定义别名
alias: {
'@': resolve('src')
}
},
externals: {
AMap: 'AMap' // ..高德地图配置
},
plugins: [
// Ignore all locale files of moment.js 去除moment的语言包,减少体积
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// gzip 配置compression-webpack-plugin压缩
new CompressionWebpackPlugin({
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
]
},
chainWebpack(config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icon'))
.end()
config.module
.rule('icon')
.test(/\.svg$/)
.include.add(resolve('src/icon'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
}
vue.config.js和postcss.config.js冲突?
而且这里的就上面写的vue.config.js,里面写了postcss后,postcss.config.js写啥也没用了,就智能在vue.config.js里写
nginx
其实不是没能力,只是没实现过和没机会做。
看了视频,大概就是请求A转发到nginx,然后nginx内部再做一层转发,比如可以把这个请求转发到4.4.4.4:8000端口上,就挺方便开发的,开发人员只需要都请求这个就行。
but不同的前端都是请求一个nginx,他们是怎么认识这些前端的,还没有试过