在 Fomantic-UI(原 Semantic-UI) 中通过编译去除 emoji 组件

摘要:
原来的Semantic-UI已经基本不怎么维护了,现在社区重新改名维护了一套Fomantic-UI,东西还都是一样的。

原来的 Semantic-UI 已经基本不怎么维护了,现在社区重新改名维护了一套 Fomantic-UI,东西还都是一样的。

最近新增了一个 emoji 组件,导致整体打包的 css 文件体积变大,但是平时可能几乎用不到,以下是寻找了一下去除的方法,也同样适用于需要定制组件打包的情况:

1、根据官方文档:https://fomantic-ui.com/introduction/build-tools.html#30-second-explanation

需要先下载 Fomantic-UI 的完整源代码,并且在本地环境有安装 gulp 工具

2、先进行一次 gulp build,会发现在根目录下生成有 semantic.json,或者直接将 semantic.json.example 文件改为 semantic.json 来进行配置

3、根据官方文档:https://fomantic-ui.com/introduction/build-tools.html#semanticjson

在此文件中可以对打包的组件进行配置,以下是完整的配置列表:

{
  //base path added to all other paths specified in "paths"
  "base": "",
   //current version of Fomantic UI
  "version": "2.8.7",
   "paths": {
     "source": {
       //source theme.config
      "config"      : "src/theme.config",
       //source definition folder
      "definitions" : "src/definitions/",
       //source site theme
      "site"        : "src/site/",
       //source themes folder
      "themes"      : "src/themes/"},
     "output": {
      //packaged source (both compressed/uncompressed)
      "packaged"     : "dist/",
       //uncompressed source
      "uncompressed" : "dist/components/",
       //compressed source
      "compressed"   : "dist/components/",
       //output directory for theme assets
      "themes"       : "dist/themes/"},
     //directory for gulp clean task
    "clean"        : "dist/"},
   //when set to an integer permission, will set dist files with this file permission
  "permission" : false,
   //whether gulp watch/build should run RTLCSS
  "rtl": false,
   //will only include components with these names
  "components": [
    "reset",
    "site",
    "button",
    "container",
    "divider",
    "flag",
    "header",
    "icon",
    "image",
    "input",
    "label",
    "list",
    "loader",
    "rail",
    "reveal",
    "segment",
    "step",
    "breadcrumb",
    "form",
    "grid",
    "menu",
    "message",
    "table",
    "ad",
    "card",
    "comment",
    "feed",
    "item",
    "statistic",
    "accordion",
    "checkbox",
    "dimmer",
    "dropdown",
    "embed",
    "modal",
    "nag",
    "popup",
    "progress",
    "rating",
    "search",
    "shape",
    "sidebar",
    "sticky",
    "tab",
    "transition",
    "api",        
    "state",
    "visibility",
    "text",
    "calendar",
    "slider",
    "toast",
    "emoji"],
  
  //generate .css/.js files for individual components (under /dist/components), but exclude them from semantic.css and semantic.js
  "individuals": [
    "form",
    "modal",
    "step",
    "emoji
  ],
  
  // whether to include special project maintainer tasks
  "admin": false
}

4、将配置文件中最后的 emoji 去除后,重新 build 即可在 dist 中获取到新的文件。

免责声明:文章转载自《在 Fomantic-UI(原 Semantic-UI) 中通过编译去除 emoji 组件》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇three添加和移除对象怎样查询SCI和EI检索号下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

Java Android 二进制文件读写

=-1){out.write;}返回。toByteArray();}1.2分段读取二进制文件,一次读取1024字节,byte[]buffer=newbyte[1024];PrivatevoidreadLocalFile()throwsIOException{StringfileName=“abcd.raw”;InputStreaminputStream=ge...

Xmind常用快捷键

快捷鍵(WINDOWS)快捷鍵(MAC)描述Ctrl+NCommand+N建立新工作簿Ctrl+OCommand+O开启工作簿Ctrl+SCommand+S储存目前工作簿Ctrl+Shift+SCommand+Shift+S储存全部工作簿Ctrl+WCommand+W关闭目前工作簿Ctrl+Shift+WCommand+Shift+W关闭全部工作簿Ctrl+...

redis make报错

所以添加参数:makeMALLOC=libc第二种类型:makeCFLAGS=“-march=x86-64”在README中有此段。...

html2canvas踩坑日记

在html2canvas<html2canvas(document.querySelector(“#capture”)).then(canvas=>{document.body.appendChild(canvas)});//图片地址是文档。身体appendChild(画布);...

selenium自动化之鼠标操作

,selenium为我们提供了一个处理此类事件的类——ActionChains。ActionChains可以模拟鼠标操作,例如单击、双击、右键单击、拖动等。鼠标移动时演示页面的截图:demo1.使用鼠标移动到WriteonOver按钮的顶部。python脚本如下:读取鼠标移动代码,首先定义浏览器驱动程序,最大化窗口,打开测试页面URL,定位到测试按钮顶部,定...

iReport制作报表,字数过多换行问题

1.当字段中显示的数据太长而无法放入表中时,需要自动换行。选择要更改的表(显示动态内容的字段),并将Stretchwithoverflow属性设置为选中。未选中前:选中后:2.然而,桌子坏了,非常难看。此时,我们需要设置一个属性,使同一行中的其他字段保持与换行字段相同的高度。此时,我们需要框选要显示在整行中的动态字段和表;将属性StretchType设置为R...