Permalink
Browse files

Offload work to clockhand mixin

  • Loading branch information...
1 parent 073a178 commit 2d0fadd16e60bc66a3a6df87160e099940589ee5 @jasonkuhrt committed Mar 8, 2013
Showing with 25 additions and 202 deletions.
  1. +3 −0 Changelog.md
  2. +2 −1 index.js
  3. +0 −1 index.styl
  4. +4 −0 package.json
  5. +15 −0 shorthand-edge-omissions.styl
  6. +0 −47 shorthand-edge-omissions/index.styl
  7. +1 −1 test-runner.js
  8. +0 −46 test/2-value.styl
  9. +0 −31 test/3-value.styl
  10. +0 −35 test/4-value.styl
  11. +0 −10 test/Readme.md
  12. +0 −30 test/only-omissions.styl
View
3 Changelog.md
@@ -1,3 +1,6 @@
+v0.1.2 ---- 7 Mar 2013 --------------------------------
+
+_ Offload work to `clockhand` stylus mixin via the new `clockhand-stylus` npm package
View
3 index.js
@@ -7,6 +7,7 @@ module.exports = pluginFactory;
function pluginFactory(){
return function plugin(stylus) {
+ stylus.use(require('clockhand-stylus')());
stylus.include(__dirname);
- }
+ };
}
View
1 index.styl
@@ -1 +0,0 @@
-@import 'shorthand-edge-omissions'
View
4 package.json
@@ -15,7 +15,11 @@
"scripts": {
"test": "make test"
},
+ "dependencies": {
+ "clockhand-stylus": "~0.1.0"
+ },
"devDependencies": {
+ "stylus-test-runner": "git://github.com/jasonkuhrt/stylus-test-runner.git"
},
"author": "Jason Kuhrt <jasonkuhrt@me.com> (http://jasonkuhrt.com)",
"license": "MIT"
View
15 shorthand-edge-omissions.styl
@@ -0,0 +1,15 @@
+@import 'clockhand'
+
+
+
+padding()
+ if _ in arguments
+ clockhand(arguments, 'padding')
+ else
+ padding arguments
+
+margin()
+ if _ in arguments
+ clockhand(arguments, 'margin')
+ else
+ padding arguments
View
47 shorthand-edge-omissions/index.styl
@@ -1,47 +0,0 @@
-
-
-
-better-clockhand(prop-args, prop)
- if not _ in prop-args
- {prop} prop-args
- else
- prop-argsCount = length(prop-args)
- important-string = null
-
- if !important in last(prop-args)
- prop-argsCount = prop-argsCount - 1
- important-string = !important
-
- // `argumentCount is 1` is a case we can safely ignore
- // because such a case can only be padding:_; given
- // we know prop-args contains _ since we passed the
- // first if
-
- if prop-argsCount is 2
- if _ isnt prop-args[0]
- {prop}-top prop-args[0] important-string
- {prop}-bottom prop-args[0] important-string
- if _ isnt prop-args[1]
- {prop}-left prop-args[1] important-string
- {prop}-right prop-args[1] important-string
-
- else if prop-argsCount is 3
- {prop}-top prop-args[0] important-string if _ isnt prop-args[0]
- if _ isnt prop-args[1]
- {prop}-left prop-args[1] important-string
- {prop}-right prop-args[1] important-string
- {prop}-bottom prop-args[2] important-string if _ isnt prop-args[2]
-
- else if prop-argsCount is 4
- {prop}-top prop-args[0] important-string if _ isnt prop-args[0]
- {prop}-right prop-args[1] important-string if _ isnt prop-args[1]
- {prop}-bottom prop-args[2] important-string if _ isnt prop-args[2]
- {prop}-left prop-args[3] important-string if _ isnt prop-args[3]
-
-
-
-padding()
- better-clockhand(arguments, "padding")
-
-margin()
- better-clockhand(arguments, "margin")
View
2 test-runner.js
@@ -9,7 +9,7 @@
var testRunnerConfig = {
describe: 'Shorthand Edge Omissions',
stylus: {
- use: require('./index'),
+ use: require('./index')(),
import: 'shorthand-edge-omissions'
}
}
View
46 test/2-value.styl
@@ -1,46 +0,0 @@
-
-
-
-// @it should support 2-value
-
-#assert
- padding _ 0
-
-#assert
- padding 0 _
-
-// @expect -------------------------------
-
-#assert {
- padding-left: 0;
- padding-right: 0;
-}
-
-#assert {
- padding-top: 0;
- padding-bottom: 0;
-}
-
-
-
-
-
-// @it should support 2-value with !important
-
-#assert
- padding _ 0 !important
-
-#assert
- padding 0 _ !important
-
-// @expect -------------------------------
-
-#assert {
- padding-left: 0 !important;
- padding-right: 0 !important;
-}
-
-#assert {
- padding-top: 0 !important;
- padding-bottom: 0 !important;
-}
View
31 test/3-value.styl
@@ -1,31 +0,0 @@
-
-
-
-// @it should support 3-value
-
-#assert { padding: 0 _ _ }
-#assert { padding: _ 0 _ }
-#assert { padding: _ _ 0 }
-
-// @expect -------------------------------
-
-#assert { padding-top:0; }
-#assert { padding-left:0; padding-right:0; }
-#assert { padding-bottom:0; }
-
-
-
-
-
-
-// @it should support 3-value with !important
-
-#assert { padding: 0 _ _ !important }
-#assert { padding: _ 0 _ !important }
-#assert { padding: _ _ 0 !important }
-
-// @expect -------------------------------
-
-#assert { padding-top: 0 !important; }
-#assert { padding-left: 0 !important; padding-right: 0 !important; }
-#assert { padding-bottom: 0 !important; }
View
35 test/4-value.styl
@@ -1,35 +0,0 @@
-
-
-
-// @it should support 4-value
-
-#assert-1 { padding: 0 _ _ _ }
-#assert-2 { padding: _ 0 _ _ }
-#assert-3 { padding: _ _ 0 _ }
-#assert-4 { padding: _ _ _ 0 }
-
-// @expect -------------------------------
-
-#assert-1 { padding-top: 0; }
-#assert-2 { padding-right: 0; }
-#assert-3 { padding-bottom: 0; }
-#assert-4 { padding-left: 0; }
-
-
-
-
-
-
-// @it should support 4-value with !important
-
-#assert-1 { padding: 0 _ _ _ !important }
-#assert-2 { padding: _ 0 _ _ !important }
-#assert-3 { padding: _ _ 0 _ !important }
-#assert-4 { padding: _ _ _ 0 !important }
-
-// @expect -------------------------------
-
-#assert-1 { padding-top: 0 !important; }
-#assert-2 { padding-right: 0 !important; }
-#assert-3 { padding-bottom: 0 !important; }
-#assert-4 { padding-left: 0 !important; }
View
10 test/Readme.md
@@ -1,10 +0,0 @@
-
-
-
- Testing Shorthand Omissions
- ---------------------------
-
- Note:
- Only padding is tested because it is assumed
- that if padding works than so does/would any
- other generated property...
View
30 test/only-omissions.styl
@@ -1,30 +0,0 @@
-
-
-
-// @it should not render when all values are omissions
-
-// This assert shouldn't render anything
-// in the CSS
-
-#assert
- padding _
- padding _ _
- padding _ _ _
- padding _ _ _ _
-
-// @expect -------------------------------
-
-
-
-
-
-
-// @it should not render when all values are omissions with !important
-
-#assert
- padding _ !important
- padding _ _ !important
- padding _ _ _ !important
- padding _ _ _ _ !important
-
-// @expect -------------------------------

0 comments on commit 2d0fadd

Please sign in to comment.