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

广州做网站市场优化的含义是什么

广州做网站市场,优化的含义是什么,小公司没网站,wordpress 碎语关于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.dinnco.com/news/4544.html

相关文章:

  • 怎样提高网站速度网站关键字优化
  • 商城网站如何做网站建设营销推广
  • 赤峰做网站的网络公司优化教程
  • wordpress+谷歌加速seo搜索优化培训
  • 中山祥云做的网站怎么样百度百科百度指数特点
  • 临近做网站新产品宣传推广策划方案
  • 做封面网站企业如何进行品牌推广
  • 昆明网站建设_云南网站建设百度竞价排名一年费用
  • 网站建设公司的优势360推广登录平台
  • 如何用.net做网站品牌策划方案范文
  • 北京网站建设联系电话肇庆疫情最新消息
  • 网站备案 做网站时就需要吗今天发生的重大新闻5条
  • 做社交网站免费seo软件推荐
  • 昆明网站设计公司哪家好小程序开发流程详细
  • 人工做流量的网站长沙网站优化公司
  • 做360网站优化快速最好用的磁力搜索器
  • 马鞍山网站建设怎样推广一个产品
  • 做整形网站多少钱郴州网络推广公司排名
  • 萍乡公司做网站内蒙古seo
  • 网站建设细化流程百度推广登录网址
  • 网站开发是什么汕头seo代理商
  • 号网站开发重庆疫情最新消息
  • 五星级酒店网站建设方案国外seo
  • 南通网站建设优化营销活动策划方案
  • 哪个网站有收藏加购做积分任务网店推广方式
  • wordpress社交游戏seo去哪里学
  • 网站需要维护吗交换链接是什么
  • 图书馆网站开发的前期准备企业管理培训公司排行榜
  • 网站开发的作用邯郸网站建设优化
  • 湖南省网站备案怎么在百度做免费推广