From 69ee06d7daa33343ed11e41eaf6302156586f28b Mon Sep 17 00:00:00 2001 From: fuzetsu Date: Sat, 7 Sep 2019 16:48:14 -0400 Subject: [PATCH] 0.7.3 fix media query nested sel regression - add section about tools to readme - update terser --- CHANGELOG.md | 8 ++++++++ README.md | 5 +++++ docs/index.js | 2 +- package-lock.json | 8 ++++---- package.json | 4 ++-- src/index.js | 5 ++--- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f8874..332c265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.7.3 + +_2019-09-07_ + +Fixed regression where nested selectors in media queries would be applied incorrectly. + +Added section about tools to readme. + ## 0.7.2 _2019-09-05_ diff --git a/README.md b/README.md index b72dd60..9b24f6b 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,11 @@ Or download the script and use it locally. [You can see all the options here.](https://unpkg.com/zaftig@latest/dist/) +## Plugins and Tools + +- [Highlight CSS Lean Strings](https://marketplace.visualstudio.com/items?itemName=fuzetsu.highlight-css-lean-strings&ssr=false#overview): a vscode plugin that will add syntax highlighting for Zaftig style strings in your JS code +- [Zaftig Tailwind](https://github.com/fuzetsu/zaftig-tailwind): a collection of helpers based on [Tailwind css](https://tailwindcss.com) + ## API Quick links: [`z`](#css) ~~ [`z.setDebug`](#set-debug) ~~ [`z.global`](#global) ~~ [`z.style`](#style) ~~ [`z.anim`](#anim) ~~ [`z.helper`](#helper) ~~ [`z.new`](#new) diff --git a/docs/index.js b/docs/index.js index 2571647..b4519df 100644 --- a/docs/index.js +++ b/docs/index.js @@ -24,7 +24,7 @@ const z = Object.assign((...args) => { const style = { sheet: { cssRules: [], - insertRule: function(rule, idx) { + insertRule(rule, idx) { this.cssRules[idx] = rule } } diff --git a/package-lock.json b/package-lock.json index 5ef85b2..df56689 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "zaftig", - "version": "0.7.2", + "version": "0.7.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -200,9 +200,9 @@ } }, "terser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.2.1.tgz", - "integrity": "sha512-cGbc5utAcX4a9+2GGVX4DsenG6v0x3glnDi5hx8816X1McEAwPlPgRtXPJzSBsbpILxZ8MQMT0KvArLuE0HP5A==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.3.0.tgz", + "integrity": "sha512-w5CzrvQOwYAH54aG22IrUJI4yX1w62XQmMdEOM6H4w0ii6rc3HJ89fmcOGN5mRwBWfUgaqO7RJTp4aoY/uE+qQ==", "dev": true, "requires": { "commander": "^2.20.0", diff --git a/package.json b/package.json index ea523b5..51e5804 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zaftig", - "version": "0.7.2", + "version": "0.7.3", "description": "css for your js", "source": "src/index.js", "main": "dist/zaftig.es5.min.js", @@ -26,6 +26,6 @@ "homepage": "https://github.com/fuzetsu/zaftig#readme", "devDependencies": { "buble": "^0.19.8", - "terser": "^4.2.1" + "terser": "^4.3.0" } } diff --git a/src/index.js b/src/index.js index 305c2d8..ec391cc 100644 --- a/src/index.js +++ b/src/index.js @@ -164,14 +164,13 @@ const makeZ = (conf = {}) => { const appendSpecial = (sel, rules, psel = '', pctx = null) => { const media = sel.indexOf('@media') == 0 - if (media) sel = sel.slice(sel.indexOf(' ') + 1) const ctx = { - sel, + sel: media ? sel.slice(sel.indexOf(' ') + 1) : sel, media, sub: [], rul: media ? wrap(psel, rules.rul) : '' } - rules.sub.forEach(n => appendRule(n.sel, n, psel == ':root' ? '' : sel, ctx)) + rules.sub.forEach(n => appendRule(n.sel, n, psel == ':root' ? '' : psel, ctx)) if (pctx) pctx.sub.push(ctx) else appendSpecialRule(ctx) }