Giter Club home page Giter Club logo

sassylists's People

Contributors

joaostein avatar kittygiraudel avatar magsout avatar mknadler avatar ncoden avatar omranjamal avatar scottkellum avatar snugug avatar timkelty avatar valeriangalliat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sassylists's Issues

NPM build is broken

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 ?

Tail should return the rest of the list

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.

typo in _prepend.scss

@if missing-dependencies(sl-is-true) == true { @return null; }

should be

@if sl-missing-dependencies(sl-is-true) == true { @return null; }

Adding aliases

Almost all functions would benefit of aliases. Could be interesting to add some.

Comments

Move to invisible comments to prevent the whole documentation from being outputed when Sass is not compiled in compressed mode.

Support reduction

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"

Improving functions for edge cases

count-values

  • Deal with an empty-list

chunk

  • Deal with $size equal to or greater than length($list)

*-nth

  • Remove error messages and return null / false instead

New functions

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)

"Invalid CSS after" at `sl-str-compare` tests

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

Add 2.2.4 release

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

npm install fails on peerDependencies of Bootcamp

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?

Rename contains()

Into contain(). No other function takes an s, no reason for it to have one.

Implement range

// 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;
}

Update to-map

// 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);
}

Namespacing the library

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-.

Wrong doc or wrong parameters in sl-remove

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);
}

Sass 4.0 `call()` deprecation warning

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.

Possible Solution

Like the warning says, use the get-function function inside each call()

Roadmap 2.0

  • Prefix all functions (#32)
  • Change all false returns to null in case of error (#34)
  • Add a dependency checker (#6)
  • Add every() and some() functions (#2)
  • Remove Compass dependency

List separators

Make some functions more future-proof with the new list-separator function.

Grunt test fails with syntax error

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.

Include pop / shift

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.

Bower

Is it possible to add this extension to bower ?

Deal with maps

For each function, either:

  • make it work
  • display an error

`compact()` breaks Compass

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.

empty list

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 to @error

Move all @warn ...; @return null to @error ...; for 3.4.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.