at-import / sassylists Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The current npm build command includes /stylesheets/_SassyLists.scss
. It contains all the @import
statements and thus generates an invalid dist file.
How did you compiled the latest dist/_SassyLists.scss
for the v3.0.0
?
gem install x
does nothing for me.
Currently, tail
is an alias of last
, returning the last item in the list. It is a common idiom to split a list into a head (first item) and tail (rest of the list), especially when using recursion.
Therefore, I propose tail
or rest
to return the rest of the list instead of the last item.
Example usage (based on this gist: https://gist.github.com/jlong/8760275):
//
// map-fetch($map, $keys)
//
// An easy way to fetch a deep value in a multi-level map. Works much like
// map-get() except that you pass multiple keys as the second parameter to
// go down multiple levels in the nested map.
//
@function map-fetch($map, $keys) {
$value: map-get($map, head($keys));
@if (length($keys) > 1) {
@return map-fetch($value, tail($keys));
} @else {
@return $value;
}
}
The code could be as easy as:
@function tail($list) {
@return slice($list, 2);
}
I'd be happy to submit a pull request, if needed.
@if missing-dependencies(sl-is-true) == true { @return null; }
should be
@if sl-missing-dependencies(sl-is-true) == true { @return null; }
Tests for sl-flatten
, sl-loop
and sl-walk
fail. But for flatten and walk, there is no visible differences between the actual result and what is expected.
See: https://gist.github.com/ncoden/0d39c464193b82090897d335e8329693
Almost all functions would benefit of aliases. Could be interesting to add some.
Update random-value() with native random instead of custom Ruby one.
Move to invisible comments to prevent the whole documentation from being outputed when Sass is not compiled in compressed mode.
The last release/publish to npm happened before the additions for eyeglass support (#60).
Hello!
A sl-reduce() function would be great! Check this:
@function reduce($list, $callback, $accumulator: 0){
@if(not function-exists($callback)){
@warn "Cannot find callback '" + inspect($callback) + "'.";
@return $accumulator;
}@else{
@each $item in $list {
$accumulator: call($callback, $accumulator, $item);
}
@return $accumulator;
}
}
And a callback:
@function add($a, $b){
@return $a + $b;
}
Could be used like this:
@debug reduce((1 2 3), add); // yields 6
@debug reduce(("hello" "world"), add, ""); // yields "hello world"
count-values
chunk
$size
equal to or greater than length($list)
*-nth
null
/ false
insteadUpdate replace-nth
function with set-nth
function: sass/sass@23310b1.
Sort values in $list
sort($list)
Returns true if every element in $list satisfies the provided testing $function
every($list, $function)
Returns true if at least one element in $list satisfies the provided testing $function
some($list, $function)
I got the following error when running tests:
> mocha test/index.js
/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/node-sass/lib/index.js:439
throw assign(new Error(), JSON.parse(result.error));
^
Error: Invalid CSS after "..., $__ORDER__ ):": expected ")", was "true,"
at Object.module.exports.renderSync (/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/node-sass/lib/index.js:439:16)
at Object.module.exports.runSass (/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/sass-true/lib/main.js:34:18)
at Object.<anonymous> (/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/test/index.js:5:10)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at /Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/mocha/lib/mocha.js:220:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/mocha/lib/mocha.js:217:14)
at Mocha.run (/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/mocha/lib/mocha.js:469:10)
at Object.<anonymous> (/Users/ncoden/Documents/Documents/Projects/Programmation/Web/Forks/sassy-lists/node_modules/mocha/bin/_mocha:404:18)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Error seems to come from the tests on the sl-str-compare
function. Something is going wrong and the test variables are exported as pure CSS.
node
: v8.9.1
node-sass
: v4.9.0
libsass
: v3.5.4
Do SassyLists play well with gulp-sass
v.1.2.0 ?
http://sassylists.com/
Everything is in the title.
The new call()
function in Sass 3.3 could enable us to create walker functions, similar to those in PHP.
http://www.php.net/manual/en/function.array-walk.php
http://sass-lang.com/documentation/Sass/Script/Functions.html#call-instance_method
This is an issue when dealing with boolean in lists.
Hi,
just tried to install 2.2.4 via bower and was wondering why I am only getting 2.2.3. Think the reason is you didn't publish a new git release
Greetings
After a fresh clone of the repository, issuing npm install
results in:
npm ERR! peerinvalid The package grunt-contrib-sass does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants grunt-contrib-sass@~0.7.2
Apparently, Bootcamp updated their dependencies to a newer version of grunt-contrib-sass: jamiebuilds/bootcamp@21be30e.
After manually updating SassyLists dependency on grunt-contrib-sass
to ~0.7.2
in package.json
, I get the following error when running grunt test
:
Running "sass:test" (sass) task
Syntax error: List index is 1 but list has no items for `nth'
on line 11 of /Users/leon/werkmap/SassyLists/node_modules/bootcamp/dist/utils/_stringify.scss, in `should'
from line 8 of test/SassyLists/_chunk.scss, in `@content'
from line 8 of /Users/leon/werkmap/SassyLists/node_modules/bootcamp/dist/core/mixins/_it.scss, in `it'
from line 7 of test/SassyLists/_chunk.scss, in `@content'
from line 14 of /Users/leon/werkmap/SassyLists/node_modules/bootcamp/dist/core/mixins/_describe.scss, in `describe'
from line 1 of test/SassyLists/_chunk.scss
from line 8 of ./test/test.scss
Use --trace for backtrace.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
Do you have any ideas for how to fix this?
Into contain()
. No other function takes an s
, no reason for it to have one.
// Build a list of values from 1 through `$n`.
//
// @ignore Documentation: http://sassylists.com/documentation.html#sl-range
//
// @param {Number} $n - maximum value
//
// @throws `$n` is not a number for `sl-range`.
// @throws `$n` is not unitless for `sl-range`.
// @throws `$n` is not greater than 0 for `sl-range`.
//
// @return {List | Null}
@function sl-range($n) {
@if type-of($n) != "number" {
@warn "`#{inspect($n)}` is not a number for `sl-range`.";
@return null;
}
@if not unitless($n) {
@warn "`#{$n}` is not unitless for `sl-range`.";
@return null;
}
@if $n < 1 {
@warn "`#{$n}` is not greater than 0 for `sl-range`.";
@return null;
}
@if $n == 1 {
@return $n;
}
$range: ();
@for $i from 1 through $n {
$range: append($range, $i);
}
@return $range;
}
Warn when dependency's missing.
// Casts `$list` into a map, using indexes as keys (starting with `$start`).
// Useful for iterating through a list with an index variable.
// e.g. `@each $index, $value in to-map($list)`
//
// @author Andrey "Lolmaus" Mikhaylov and Chris Eppstein
//
// @ignore Documentation: http://sassylists.com/documentation.html#sl-to-map
//
// @param {List} $list - list to turn into map
//
// @requires sl-range
//
// @throws List cannot be empty for `sl-to-map`.
//
// @return {Map | Null}
@function sl-to-map($list) {
@if sl-missing-dependencies(sl-range) { @return null; }
@if length($list) == 0 {
@warn "List cannot be empty for `sl-to-map`.";
@return null;
}
@return zip(sl-range(length($list)), $list);
}
Since there is no namespace, it might be interesting to find a way to namespace all functions. Maybe with an underscore _
(which works as an hyphen in Sass). Or sl-
.
Instead of purging all falsy values, why not make $new-value: null
remove matches.
replace( (0, 1, 2, 3), 2);
=> (0, 1, 3)
https://github.com/Team-Sass/SassyLists/blob/master/stylesheets/SassyLists/_replace.scss#L32
Hi!
Just saw there is some problem in sl-remove.
The docs say something about $recursive but sl-remove only got 2 parameters $list and $value.
/**
* Removes value(s) `$value` from `$list`.
*
* @ignore Documentation: http://sassylists.com/documentation.html#sl-remove
*
* @requires sl-replace
*
* @param {List} $list - list to update
* @param {*} $value - value to remove
* @param {Bool} $recursive - enable/disable recursion
*
* @example
* sl-remove(a b c, a)
* // b c
*
* @return {List}
*/
@function sl-remove($list, $value) {
@if sl-missing-dependencies(sl-replace) == true { @return null; }
@return sl-replace($list, $value, null);
}
The following is reported by node-sass v4.8.3
DEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal
in Sass 4.0. Use call(get-function("fade")) instead.
Like the warning says, use the get-function function inside each call()
$list: a b c;
$str: to-string($list, "-"); // "a-b-c-"
Make some functions more future-proof with the new list-separator
function.
When running grunt test
I get an error from Bootcamp:
Syntax error: List index is 1 but list has no items for `nth'
on line 11 of /path/to/SassyLists/node_modules/bootcamp/dist/utils/_stringify.scss, in `should'
Ruby: ruby-2.1.1
Sass: 3.3.4
SassyLists: 1.0.0
Bootcamp: 1.1.2
Will try to debug further, to find if this is an issue with Bootcamp or with SassyLists tests.
Would be nice to have functions to remove the first / last items in a list; sl-pop
and sl-shift
. I know it's easy enough to do with what already exists, but would be cleaner. Could also add sl-unpop
/ sl-unshift
.
Is it possible to add this extension to bower ?
For each function, either:
I've been receiving a nasty error:
Function compact takes 1 argument but 10 were passed.
Took me a while to figure this out.
Function compact()
, used in SassyLists, overrides a Compass function with the same name.
When you import SassyLists and then try to use Compass' transition()
(and a number of other helpers), you receive the aforementioned error.
SassyLists' compact()
is an internal function, so it should be safe to rename it.
Hello,
I either couldn't find it or it is not there.. however I am missing a function like "sl-empty" or "is-empty" or something like that. It may look like this:
@function sl-empty($list) {
@if length($list) == 0 {
@return true;
} @else {
@return false;
}
}
Move all @warn ...; @return null
to @error ...;
for 3.4.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.