Skip to content

Prepare Tailwind 2.0 - Part 2 #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x]

steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Use cached node_modules
id: cache
uses: actions/[email protected]
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/yarn.lock') }}-${{ matrix.node-version }}
restore-keys: |
nodeModules-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
env:
CI: true
- run: npm run prepublishOnly
- run: npm test
env:
CI: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules
package-lock.json
/demo/out
coverage/
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"trailingComma": "es5"
},
"scripts": {
"test": "jest",
"dev": "next dev demo",
"build": "next build demo",
"export": "next export demo",
Expand All @@ -34,10 +35,13 @@
"cssnano": "^4.1.10",
"dedent": "^0.7.0",
"highlight.js": "^9.15.6",
"jest": "^26.6.1",
"next": "^9.4.4",
"postcss": "^7.0.17",
"react": "^16.8.6",
"prettier": "^2.1.2",
"react-dom": "^16.8.6",
"react": "^16.8.6",
"snapshot-diff": "^0.8.1",
"tailwindcss": "^2.0.0-alpha.1"
}
}
9 changes: 6 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const computed = {

function configToCss(config) {
return merge(
{},
...Object.keys(config)
.filter((key) => computed[key])
.map((key) => computed[key](config[key])),
Expand All @@ -26,18 +27,20 @@ module.exports = plugin.withOptions(
[
{
[`.${className}`]: merge(
...castArray(styles.default.css),
configToCss(config.default || {})
{},
...castArray(styles.DEFAULT.css),
configToCss(config.DEFAULT || {})
),
},
...modifiers.map((modifier) => ({
[`.${className}-${modifier}`]: merge(
{},
...castArray(styles[modifier].css),
configToCss(config[modifier] || {})
),
})),
...Object.keys(config)
.filter((key) => !['default', ...modifiers].includes(key))
.filter((key) => !['DEFAULT', ...modifiers].includes(key))
.map((modifier) => ({
[`.${className}-${modifier}`]: configToCss(config[modifier]),
})),
Expand Down
Loading