This repository has been archived by the owner on Mar 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
6,834 additions
and
1,979 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"useBuiltIns": "usage", | ||
"corejs": 3, | ||
}, | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
last 2 versions, not dead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ module.exports = { | |
extends: "@hacss", | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.eslintcache | ||
dist |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import compose from "@hacss/compose-plugins"; | ||
import copy from "@hacss/plugin-copy/src/index.js"; | ||
import del from "@hacss/plugin-delete/src/index.js"; | ||
|
||
export default spec => compose(del(Object.keys(spec)), copy(spec)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
const { expect } = require("chai"); | ||
const expandPlugin = require("../index.js"); | ||
const assert = require("assert"); | ||
const expandPlugin = require("../dist/hacss-plugin-expand.umd.js"); | ||
|
||
describe("expand plugin", () => { | ||
const spec = { | ||
"margin-x": ["margin-left", "margin-right"], | ||
}; | ||
const spec = { | ||
"margin-x": ["margin-left", "margin-right"], | ||
}; | ||
|
||
const [ expand, properties ] = expandPlugin(spec); | ||
const test = (actual, expected) => { | ||
console.log(`${JSON.stringify(actual)} === ${JSON.stringify(expected)}`); | ||
assert.deepEqual(actual, expected); | ||
}; | ||
|
||
it("should expand specified properties", () => { | ||
expect(expand({ "margin-x": "20px", "padding-top": "40px" })) | ||
.to.deep.equal({ | ||
"margin-left": "20px", | ||
"margin-right": "20px", | ||
"padding-top": "40px", | ||
}); | ||
}); | ||
const [expand, properties] = expandPlugin(spec); | ||
|
||
it("should add the properties in the spec to the list of recognized properties", () => { | ||
expect(properties).to.deep.equal(Object.keys(spec)); | ||
}); | ||
test(expand({ "margin-x": "20px", "padding-top": "40px" }), { | ||
"margin-left": "20px", | ||
"margin-right": "20px", | ||
"padding-top": "40px", | ||
}); | ||
|
||
test(properties, Object.keys(spec)); | ||
console.log("All tests passed."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const path = require("path"); | ||
|
||
module.exports = [ | ||
["hacss-plugin-expand.umd.js", "development"], | ||
["hacss-plugin-expand.umd.min.js", "production"], | ||
].map(([filename, mode]) => ({ | ||
entry: "./src/index.js", | ||
output: { | ||
path: path.join(__dirname, "dist"), | ||
filename, | ||
library: ["hacssPlugins", "expand"], | ||
libraryTarget: "umd", | ||
globalObject: "this", | ||
libraryExport: "default", | ||
}, | ||
resolve: { | ||
alias: { | ||
"core-js": "core-js-pure", | ||
}, | ||
}, | ||
module: { | ||
rules: [{ test: /\.js$/, use: "babel-loader" }], | ||
}, | ||
mode, | ||
devtool: "source-map", | ||
})); |