当前位置: 首页 > news >正文

视频网站主持人九江做网站的公司哪里好

视频网站主持人,九江做网站的公司哪里好,建设银行网站查询密码设置,公司推广做哪个网站吗关于Vuewebpack使用unocss编写CSS,打包后CSS没加前缀,封装了一个插件去解决了这个问题 unocss-postcss-webpack-plugin unocss在vite中使用配置,关于unocss在vite中使用,自行查阅官网 https://unocss.dev/integrations/vite ,vi…

关于Vue+webpack使用unocss编写CSS,打包后CSS没加前缀,封装了一个插件去解决了这个问题

unocss-postcss-webpack-plugin

unocss在vite中使用配置,关于unocss在vite中使用,自行查阅官网 https://unocss.dev/integrations/vite ,vite使用unocss就不会出现这样的问题

//vite.config.ts
import { fileURLToPath, URL } from 'node:url'
import UnoCSS from 'unocss/vite'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'// https://vitejs.dev/config/
export default defineConfig({plugins: [vue(),vueJsx(),UnoCSS()],resolve: {alias: {'@': fileURLToPath(new URL('./src', import.meta.url))}},css: {postcss: {plugins: [require('autoprefixer')({overrideBrowserslist: ['Android >= 6', 'iOS >= 10', 'ie >= 11', 'Firefox >= 35', 'chrome >= 40','safari >= 6']})]},}
})

使用

<template><div><div class="w-200px h-200px bg-gray-400 flex items-center justify-center">vite中使用unocss的写法</div><div class="box">vite中没有使用unocss的写法</div></div>
</template><script setup lang="ts"></script><style scoped>
.box{display: flex;align-items: center;justify-content: center;background-color: red;width: 200px;height: 200px;
}
</style>

CSS展示

1
2

unocss在webpack中使用配置,关于unocss在webpack中使用,自行查阅官网 https://unocss.dev/integrations/webpack

const { defineConfig } = require('@vue/cli-service');
const UnoCSS = require('@unocss/webpack').default
module.exports = defineConfig({lintOnSave: false,transpileDependencies: true,configureWebpack: {plugins: [UnoCSS({})],},css: {loaderOptions: {postcss: {postcssOptions: {plugins: [require('autoprefixer')({overrideBrowserslist: ['Android >= 6', 'iOS >= 10', 'ie >= 11', 'Firefox >= 35', 'chrome >= 40','safari >= 6']})],},},}},
});
<template><div><div class="w-200px h-200px bg-gray-400 flex items-center justify-center">webpack使用unocss的写法</div><div class="box">webpack没有使用unocss的写法</div></div>
</template><script setup lang="ts"></script><style scoped>
.box{display: flex;align-items: center;justify-content: center;background-color: red;width: 200px;height: 200px;
}
</style>

CSS展示

1
2

比较发现,在webpack中,unocss写法的css样式没有添加css前缀,详情可看这个issue https://github.com/unocss/unocss/issues/386

使用unocss-postcss-webpack-plugin插件 webpack中,unocss 添加 postcss 编译 ,配合@unocss/webpack使用,前提已在项目中配置了unocss相关配置,以及项目中的css是单独打包成独立的css文件

install

npm i unocss-postcss-webpack-plugin -D

使用

//vue.config.js
const { defineConfig } = require('@vue/cli-service');
const UnoCSS = require('@unocss/webpack').default
const unocssPostcssWebpackPlugin=require('unocss-postcss-webpack-plugin')
module.exports = {configureWebpack: {plugins: [UnoCSS({}),unocssPostcssWebpackPlugin(), ],},css:{loaderOptions: {postcss: {postcssOptions: {plugins: [require('autoprefixer')({overrideBrowserslist: ['Android >= 6', 'iOS >= 10', 'ie >= 11', 'Firefox >= 35', 'chrome >= 40','safari >= 6']})],},},},extract:true,//这个主要是设置单独打包css,}
}

CSS展示

unocss编写的css样式也加上了css前缀

3

props

PropTypeDefaultdescriptionrequired
overrideBrowserslistArray[‘Android >= 6’, ‘iOS >= 10’, 'ie >= 1,‘Firefox >= 35’, ‘chrome >= 40’,‘safari >= 6’]browserslistfalse
http://www.yayakq.cn/news/585112/

相关文章:

  • 镇江网站建设制作企业怎样修改wordpress模板
  • 浙江省工程建设监理管理协会网站广东两学一做考学网站
  • 没得公司可以做网站嘛广州微网站建设信息
  • 网站建设补充报价单wordpress 页面分栏
  • 长春网站建设于健企业品牌推广方案范文
  • 响应式电商网站制作做宾馆网站好
  • 最好的微网站建设公司永康网站建设制作
  • 网站外链如何建设wordpress模板搬迁
  • 推广网站怎么做模板百度问答app下载
  • 企业网站开发软件wordpress灯箱代码
  • 鹿城区住房和城乡建设局网站网站建设公司怎么谈单
  • 手机网站分页设计wordpress社区系统
  • nike建设网站的目的做房产网站需要多少钱
  • 益阳网站建设企业智慧园区 展厅设计
  • 设计开发建设网站平台摄影师网站html5
  • 网站建设企业的市场分析注册一个公司一年费用
  • 用php做注册网站的代码网站制作首先
  • 网站开发的问题手工活接单在家做有正规网站吗
  • 手机网站开发框架杭州职业能力建设网
  • cookie做网站访问量网站设计的公司报价
  • 男人女人做那个网站自学电商运营教程
  • 临沂网站开发技术员网站后台密码文件
  • 精美个人主页安徽建站优化哪里有
  • 成都前几年网站建设公司深圳软件公司招聘
  • 在电脑上怎么做网站html代码hr表示
  • 南沙区网站建设企业管理咨询做什么的
  • 网站开发绑定微信qq注册专门做书单的网站
  • 濮阳建设企业网站公司购物商城外贸网站建设
  • 5个网站建设大连建设网网址是多少啊
  • 定制网站设计方案wordpress pdf下载插件