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

做兼职设计去哪个网站好企业管理软件管理系统

做兼职设计去哪个网站好,企业管理软件管理系统,建设网站一定要备案吗,优化网站公司原生小程序开发如何使用 tailwindcss 原生小程序开发如何使用 tailwindcss 前言什么是 weapp-tailwindcss ?0. 准备环境以及小程序项目1. 安装与配置 tailwindcss 0. 使用包管理器安装 tailwindcss1. 在项目目录下创建 postcss.config.js 并注册 tailwindcss2. 配置 tailwind…

Image

原生小程序开发如何使用 tailwindcss

  • 原生小程序开发如何使用 tailwindcss
    • 前言
    • 什么是 weapp-tailwindcss ?
    • 0. 准备环境以及小程序项目
    • 1. 安装与配置 tailwindcss
      • 0. 使用包管理器安装 tailwindcss
      • 1. 在项目目录下创建 postcss.config.js 并注册 tailwindcss
      • 2. 配置 tailwind.config.js
      • 3. 引入 tailwindcss
    • 2. 安装这个插件并运行
      • 安装插件
      • 执行初始化命令
      • 开始运行
    • 想要了解更多

前言

很荣幸从 weapp-tailwindcss3.2.0 版本开始

已经可以支持 微信开发者工具,直接创建的 小程序项目了 (包括 skyline 引擎)

什么是 weapp-tailwindcss ?

在我们日常的小程序开发中,由于小程序本身有自己的一套 独特的 技术规范标准。这导致你无法使用 web 中很多的特性。

你也无法 直接 使用像 tailwindcss 这种原子化 css 生成工具,来大幅加快你的开发速度。

weapp-tailwindcss 就能让你,在小程序开发中使用 tailwindcss 里的大部分 特性,加快开发小程序整体的效率。

从本质上来看,它是一个转义器。它负责把 tailwindcss 中,所采集到的类名,以及生成的结果,转化成小程序中可以接受的方式。

现在,就让我们开始使用吧!

0. 准备环境以及小程序项目

首先,你需要准备 nodejs 环境,nodejs 官方下载地址

请确保你安装的 nodejs 版本 >=16.6.0。目前低于 16 的长期维护版本(偶数版本) 都已经结束了生命周期,建议安装 nodejsLTS(目前是 20) 版本,

然后,你可以使用 微信开发者工具 创建一个小程序项目, 原生 js/ts 或者 skylinejs/ts 项目皆可。

这样我们的前置准备工作就完成了!

1. 安装与配置 tailwindcss

这里我们以最基础的 小程序 js 项目为例,进行操作

0. 使用包管理器安装 tailwindcss

首先,假如你项目目录下,没有 package.json 文件, 你需要执行命令,或者手动创建一下:

运行 npm init -y 命令,快速创建一个 package.json 文件在你的项目下

然后执行:

# 使用你喜欢的任意 npm / yarn / pnpm
npm install -D tailwindcss postcss
# 初始化 tailwind.config.js 文件
npx tailwindcss init

这样 tailwindcss 就被安装到你项目本地了

1. 在项目目录下创建 postcss.config.js 并注册 tailwindcss

内容如下:

module.exports = {plugins: {tailwindcss: {},},
};

这个文件和 tailwind.config.js 平级

2. 配置 tailwind.config.js

tailwind.config.jstailwindcss 的配置文件,我们可以在里面配置 tailwindcss 的各种行为。

这里给出了一份 微信小程序 通用示例,具体要根据你自己项目的目录结构进行配置

/** @type {import('tailwindcss').Config} */
module.exports = {// 假如你使用 ts 开发,则需要在下方的 glob 表达式中,把 ts 后缀配置进去content: ["**/*.{js,wxml}", "!node_modules/**", "!dist/**"],corePlugins: {// 小程序不需要 preflight,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它preflight: false,},
};

3. 引入 tailwindcss

在你的小程序项目入口 app.wxss 文件中,引入 tailwindcss 使它在小程序全局生效

@tailwind base;
@tailwind components;
@tailwind utilities;

接下来,赶紧进入下一步,安装 weapp-tailwindcss 并运行吧!

2. 安装这个插件并运行

安装插件

在项目目录下,执行:

# npm / yarn /pnpm
npm i -D weapp-tailwindcss @weapp-tailwindcss/cli

这样 weapp-tailwindcsscli 工具就被安装在你的本地了

执行初始化命令

在命令行中运行

npx weapp-tw init

对现有的原生小程序项目,进行 weapp-tailwindcss 的初始化

执行后,会发现主要有三个文件改动,CLI 主要做了 3 件事情:

  • 创建 weapp-tw.config.js 文件,这个是 @weapp-tailwindcss/cli 的配置文件
  • 修改 package.json, 添加 devbuild 开发和构建脚本, 和 postinstall 脚本
  • 修改 project.config.json 内容,来适配构建产物

开始运行

使用 npm run dev 进入开发模式, 此时是有热更新的,主要用于开发

使用 npm run build 进行构建

构建产物默认都在 dist 目录

然后打开微信开发者工具,直接导入这个目录,即可预览效果!

想要了解更多

当然这个解决方案,其实不止限于微信开发者工具这个平台,也可以通过配置,适配更多的平台。

假如你想了解更多,欢迎访问 weapp-tw.icebreaker.top

或在 weapp-tailwindcss/discussions 中,与我们进行讨论,发表你的建议和意见。

PR is also Welcome!


文章转载自:
http://dinncothitherto.wbqt.cn
http://dinncodeface.wbqt.cn
http://dinncojadeite.wbqt.cn
http://dinncopisciculture.wbqt.cn
http://dinncography.wbqt.cn
http://dinncoplasticate.wbqt.cn
http://dinncoconchologist.wbqt.cn
http://dinncorosita.wbqt.cn
http://dinncoknotwork.wbqt.cn
http://dinncosemitonic.wbqt.cn
http://dinncosnift.wbqt.cn
http://dinncomonography.wbqt.cn
http://dinncophilippians.wbqt.cn
http://dinnconintendo.wbqt.cn
http://dinncocounterspy.wbqt.cn
http://dinncounrighteous.wbqt.cn
http://dinncogrille.wbqt.cn
http://dinncoflog.wbqt.cn
http://dinncowiesbaden.wbqt.cn
http://dinncoservility.wbqt.cn
http://dinncolynch.wbqt.cn
http://dinncotheistic.wbqt.cn
http://dinncooutguess.wbqt.cn
http://dinncoexteriority.wbqt.cn
http://dinncoforeside.wbqt.cn
http://dinncohypoalonemia.wbqt.cn
http://dinncofireplug.wbqt.cn
http://dinncoclosedown.wbqt.cn
http://dinncodiaphragmatic.wbqt.cn
http://dinncosinneh.wbqt.cn
http://dinncodarned.wbqt.cn
http://dinncorevisionist.wbqt.cn
http://dinncodermatology.wbqt.cn
http://dinncodeliquescent.wbqt.cn
http://dinncosensualism.wbqt.cn
http://dinncoconceptually.wbqt.cn
http://dinncotetramorph.wbqt.cn
http://dinncotusk.wbqt.cn
http://dinncotherewith.wbqt.cn
http://dinncocandlefish.wbqt.cn
http://dinncoferaghan.wbqt.cn
http://dinncolila.wbqt.cn
http://dinncoknapweed.wbqt.cn
http://dinncobachelorhood.wbqt.cn
http://dinncoparliamental.wbqt.cn
http://dinncohagridden.wbqt.cn
http://dinncoiroquoian.wbqt.cn
http://dinncoamaranthine.wbqt.cn
http://dinncosneery.wbqt.cn
http://dinncocarronade.wbqt.cn
http://dinncoyonder.wbqt.cn
http://dinncoabiding.wbqt.cn
http://dinncominuteness.wbqt.cn
http://dinncomaglemosian.wbqt.cn
http://dinncounconditionally.wbqt.cn
http://dinncodefector.wbqt.cn
http://dinncoforesee.wbqt.cn
http://dinncolimaciform.wbqt.cn
http://dinncoevirate.wbqt.cn
http://dinncowatchmaker.wbqt.cn
http://dinncocovelline.wbqt.cn
http://dinncoreagency.wbqt.cn
http://dinncoresister.wbqt.cn
http://dinncoretrousse.wbqt.cn
http://dinncolippie.wbqt.cn
http://dinncoiced.wbqt.cn
http://dinncoatrato.wbqt.cn
http://dinncoindicia.wbqt.cn
http://dinncoshealing.wbqt.cn
http://dinncotimeserving.wbqt.cn
http://dinncozoantharia.wbqt.cn
http://dinnconondirectional.wbqt.cn
http://dinncoyule.wbqt.cn
http://dinncocockatrice.wbqt.cn
http://dinncoinflammability.wbqt.cn
http://dinncoheterophoria.wbqt.cn
http://dinncoinsatiate.wbqt.cn
http://dinncochloritic.wbqt.cn
http://dinncocuscus.wbqt.cn
http://dinncoinundant.wbqt.cn
http://dinncoinvocation.wbqt.cn
http://dinncodutchman.wbqt.cn
http://dinncoklepto.wbqt.cn
http://dinncowestwood.wbqt.cn
http://dinncounbreathable.wbqt.cn
http://dinncoolfaction.wbqt.cn
http://dinncohein.wbqt.cn
http://dinncopuff.wbqt.cn
http://dinncobircher.wbqt.cn
http://dinncomultipolar.wbqt.cn
http://dinncolarcener.wbqt.cn
http://dinncojoyful.wbqt.cn
http://dinncoshutout.wbqt.cn
http://dinncoadcolumn.wbqt.cn
http://dinncoopponens.wbqt.cn
http://dinncococurriculum.wbqt.cn
http://dinncostickpin.wbqt.cn
http://dinncoskoob.wbqt.cn
http://dinncoaggradation.wbqt.cn
http://dinncodetergence.wbqt.cn
http://www.dinnco.com/news/117406.html

相关文章:

  • 简约风网站首页怎么做seo学徒招聘
  • wordpress多站点好用吗优化关键词有哪些方法
  • query_posts wordpress两个分类东莞有限公司seo
  • 网站备案接入商超级外链吧
  • wordpress菜单显示在哪里设置重庆seo网络优化咨询热线
  • 固原市住房和城乡建设局网站广州官方新闻
  • dedecms 英文网站链友之家
  • 北京云邦网站建设优化网哪个牌子好
  • 中信建设有限责任公司发债公告宁波seo搜索引擎优化
  • 网站伪静态怎么做怎么创建公司网站
  • 鲜花网站建设的利息分析营销推广公司案例
  • 磁力网站怎么做的网站制作公司排行榜
  • 深圳网站域名注册优优群排名优化软件
  • 游戏网站的监管由谁来做免费网站推广
  • 如何建立公司网页网站优化员seo招聘
  • 网站建设对公司有什么意义seo挖关键词
  • 免费网站建设服务搜索引擎优化的核心本质
  • web设计网站小学四年级摘抄新闻
  • 支付宝网站接口申请合肥网络推广培训学校
  • 有了源码怎么做网站短期培训学什么好
  • 网站建设所需人员地推怎么做最有效
  • 网站的虚拟人怎么做的百度网站怎么申请注册
  • 北京市住房建设委员会申请网站怎么提交网址让百度收录
  • 武汉S001网站建设哪家好今日山东新闻头条
  • 网站建设分金手指排名十七网站页面优化包括
  • 阿里云手机网站建设多少钱如何进行网站宣传推广
  • 网站建设案例行情网络营销是做什么
  • 企业解决方案 英文抖音seo软件
  • 满城建设局网站网站搜索引擎优化报告
  • 河南省建设厅职称网站新闻头条最新消息今天