[Tailwind] Create Custom Utility Classes in Tailwind
In this lesson, we learn how to generate custom utility classes in tailwind. We add new properties to our JavaScript config object to generate new helper classes to suit our needs.
Update gulpfile.js:
const gulp = require("gulp");
const postcss = require("gulp-postcss");
const tailwindcss = require("tailwindcss");
const PATHS = {
css: "./src/styles.css",
config: "./tailwind.js",
dist: "./"
};
gulp.task("css", () => {
return gulp
.src(PATHS.css)
.pipe(postcss([tailwindcss(PATHS.config), require("autoprefixer")]))
.pipe(gulp.dest(PATHS.dist));
});
gulp.task("default", ["css"], () => {
gulp.watch(PATHS.config, ["css"]);
});
For example, you want to add some custom margin and padding in tailwind.js file:
margin: {
'auto': 'auto',
'px': '1px',
'0': '0',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem',
'16': '4rem', //added
'crazy': '8rem', //added
},
padding: {
'px': '1px',
'0': '0',
'1': '0.25rem',
'2': '0.5rem',
'3': '0.75rem',
'4': '1rem',
'6': '1.5rem',
'8': '2rem',
'16': '4rem', //added
'crazy': '16rem', //added
},
After run 'gulp' command.
index.html
<h1 class="text-purple
bg-pink-dark
p-crazy mt-crazy">Hello Tailwind!</h1>
Checkout more on docs.
[Tailwind] Create Custom Utility Classes in Tailwind的更多相关文章
- [Tailwind] Extending Tailwind with Responsive Custom Utility Classes
You are able to extend the custom css with hover, focus, group-hover, responsive variants class in t ...
- [Tailwind] Apply mobile-first Responsive Classes in Tailwind
In this lesson, we take a look at tailwind's mobile-first CSS architecture and learn how to apply st ...
- [Tailwind] Abstract Utility Classes to BEM Components in Tailwind
When creating UIs with utility classes, a lot of repetition can occur within the HTML markup. In thi ...
- Utility Classes Are Evil
原文地址:http://alphawang.com/blog/2014/09/utility-classes-are-evil/ This post is a summary of this arti ...
- How to: Create Custom Configuration Sections Using ConfigurationSection
https://msdn.microsoft.com/en-us/library/2tw134k3.aspx You can extend ASP.NET configuration settings ...
- Top 15 Java Utility Classes
In Java, a utility class is a class that defines a set of methods that perform common functions. Thi ...
- How to Create Custom Filters in AngularJs
http://www.codeproject.com/Tips/829025/How-to-Create-Custom-Filters-in-AngularJs Introduction Filter ...
- create custom launcher icon 细节介绍
create custom launcher icon 是创建你的Android app的图标 点击下一步的时候,出现的界面就是创建你的Android的图标 Foreground: ” Foregro ...
- add a private constructor to hide the implicit public one(Utility classes should not have public constructors)
sonarlint提示add a private constructor to hide the implicit public one Utility classes should not have ...
随机推荐
- oc22--多态
// // Animal.h #import <Foundation/Foundation.h> @interface Animal : NSObject { int _age; } - ...
- [javascript] jQuery系列之目录汇总
最近一个月写了些关于jQuery的文章,谢谢大家的支持.文章仅我个人观点,也许有不对的地方,请指出.这个系列还在更新中 一:jQuery基础系列: jQuery温习篇---强大的JQuery选择器 j ...
- hiho一下第76周《Suzhou Adventure》
我是菜鸡,我是菜鸡,我是菜鸡....重要的事说三遍 算是第一次做树形dp的题吧,不太难.. 园林构成一棵树,root为1,Hi从root出发,有k个园林必须玩,每个园林游玩后会得到权值w[i],最多玩 ...
- H3BPM子表的复制
在做一个流程的时候,碰到了下面的表数据直接从上表中获取,并且为不可编辑状态,没有增加和删除行的按钮.一开始使用的是ComputationRule属性,但是有一项是日期空间,没有这个属性,不知道怎么处理 ...
- 全面改造升级内部OA系统
项目功能集团的OA办公系统,分别是销售管理系统.财务付款系统.原料采购系统.成品采购系统.担保系统和库房管理系统业务现状成品采购系统.库房管理系统.销售管理系统是Access开发的C/S系统,采用本地 ...
- Codeforces Round #446
Greed #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector&g ...
- [Offer收割]编程练习赛35
有歧义的号码 #include<stdio.h> #include<string.h> #include<stdlib.h> int cmp(const void ...
- 06 Django组件-cookie与session
一.会话跟踪技术 1.什么是会话跟踪技术 我们需要先了解一下什么是会话!可以把会话理解为客户端与服务器之间的一次会晤,在一次会晤中可能会包含多次请求和响应.例如你给10086打个电话,你就是客户端,而 ...
- Nginx+Keepalived(双机热备)搭建高可用负载均衡环境(HA)-转帖篇
原文:https://my.oschina.net/xshuai/blog/917097 摘要: Nginx+Keepalived搭建高可用负载均衡环境(HA) http://blog.csdn.ne ...
- Mysql笔记2-----重要小点
1.逻辑删除: