@seedcss/seed-props
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "@seedcss/seed-props", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Props mixin pack for Seed", | ||
@@ -41,9 +41,7 @@ "main": "index.js", | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"devDependencies": { | ||
"mkdirp": "^0.5.1", | ||
"node-sass": "^4.9.3", | ||
"seed-bistro": "^0.2.0" | ||
"sass-pathfinder": "^0.0.5", | ||
"seed-bistro": "^0.2.1" | ||
}, | ||
@@ -54,5 +52,3 @@ "publishConfig": { | ||
"prepublish": "npm run build", | ||
"postversion": "npm run build", | ||
"prepack": "npm run build", | ||
"gitHead": "8bf23e91822b26218c812f2ea845a0f33773a62a" | ||
"gitHead": "0749da9715a0e19c23feb2570c6c88583a1fce02" | ||
} |
101
README.md
@@ -1,5 +0,9 @@ | ||
# seed-props [![npm version](https://badge.fury.io/js/%40seedcss%2Fseed-props.svg)](https://badge.fury.io/js/%40seedcss%2Fseed-props) | ||
Props mixin pack for [Seed](https://github.com/helpscout/seed)! | ||
# seed-props | ||
[![npm version](https://badge.fury.io/js/%40seedcss%2Fseed-props.svg)](https://badge.fury.io/js/%40seedcss%2Fseed-props) | ||
> Props mixin pack for Seed | ||
## Install | ||
``` | ||
@@ -9,3 +13,2 @@ npm install @seedcss/seed-props --save | ||
## Documentation | ||
@@ -15,26 +18,32 @@ | ||
## Basic Usage | ||
### SCSS | ||
This seed pack needs to be imported into your sass pipeline. Below is an example using Gulp: | ||
```javascript | ||
var gulp = require('gulp'); | ||
var sass = require('gulp-sass'); | ||
var pack = require('seed-props'); | ||
const gulp = require("gulp"); | ||
const sass = require("gulp-sass"); | ||
const pathfinder = require("sass-pathfinder"); | ||
const pack = require("@seedcss/seed-props"); | ||
gulp.task('sass', function () { | ||
return gulp.src('./sass/**/*.scss') | ||
.pipe(sass({ | ||
includePaths: pack | ||
})) | ||
.pipe(gulp.dest('./css')); | ||
gulp.task("sass", function() { | ||
return gulp | ||
.src("./sass/**/*.scss") | ||
.pipe( | ||
sass({ | ||
includePaths: pathfinder( | ||
// Other includePaths... | ||
pack | ||
) | ||
}) | ||
) | ||
.pipe(gulp.dest("./css")); | ||
}); | ||
``` | ||
Once that is setup, simply `@import` *seed-props* as needed in your `.scss` file: | ||
Once that is setup, simply `@import` **seed-props** as needed in your `.scss` file: | ||
```sass | ||
```scss | ||
// Packs | ||
@@ -44,61 +53,13 @@ @import "pack/seed-props/_index"; | ||
## Usage | ||
### prop-map | ||
The `prop-map` mixin allows you to loop through a map and use arguments as variables in your styles (`@content`). | ||
You have to use the `prop` function for your `@content` to utilize the argument defined in your `prop-map`. | ||
#### Simple | ||
```sass | ||
// Input (scss) | ||
$grid-columns: ( | ||
1: 10%, | ||
2: 20% | ||
); | ||
## Options | ||
.col- { | ||
@include prop-map($grid-columns, (width)) { | ||
width: prop(width); | ||
} | ||
} | ||
The following variables can be found in `_config.scss` | ||
// Output (css) | ||
.col-1 { | ||
width: 10%; } | ||
```scss | ||
// Props :: Config | ||
.col-2 { | ||
width: 20%; } | ||
``` | ||
$SEED_PROPS_MAP__GLOBAL: null !global; | ||
#### Slightly trickier (aka. Awesome) | ||
Yo dawg. I heard you like using maps within maps. `prop-map` will be able to handle that! | ||
```sass | ||
// Input (scss) | ||
$btn-states: ( | ||
success: ( | ||
background: green, | ||
border-color: green), | ||
danger: ( | ||
background: red, | ||
border-color: red) | ||
); | ||
.btn { | ||
@include prop-map($btn-states, (background, border-color)) { | ||
background: prop(background); | ||
border-color: prop(border-color); | ||
} | ||
} | ||
// Output (css) | ||
.btn-success { | ||
background: green; | ||
border-color: green; } | ||
.btn-danger { | ||
background: red; | ||
border-color: red; } | ||
``` | ||
P.S. For maps within maps, the arguments are based on *name* (not the argument order). | ||
``` |
@@ -14,3 +14,3 @@ var fs = require('fs'); | ||
var banner = ['/**', | ||
' * '+ pkg.name +' v'+ pkg.version + homepage(), | ||
' * '+ pkg.name + homepage(), | ||
' * '+ pkg.description, | ||
@@ -17,0 +17,0 @@ ' * Licensed under '+ pkg.license, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8124
4
62
1