Spriting that sass has been missing

Circle CI Coverage Status Report Card Appveyor

Wellington

Join the chat at https://gitter.im/wellington/wellington

Wellington adds spriting to the lightning fast libsass. No need to learn a new tool, this all happens right in your Sass!

OS Support

Binaries are provided for Linux and OS X. Building from source will work on any os libSass supports. Windows support has been dropped due to Issue #160

Use with Grunt or Gulp

See the Grunt example See the Gulp Example

Speed Matters

Benchmarks

# 40,000 line of code Sass project with 1200 images
wt         3.679s
compass   73.800s
# 20x faster!

For more benchmarks, see realbench

What it does

wt is a Sass preprocessor tool geared towards projects written in Sass. It focuses on tasks that make working on a Sass site friendlier and much faster. wt extends the Sass language to include spriting and image operations not currently possible in the core language.

$images: sprite-map("sprites/*.png");
div {
  width: image-width(sprite-file($images, "cat"));
  height: image-height(sprite-file($images, "cat"));
  background: sprite($images, "cat");
}

The output CSS

div {
  width: 140px;
  height: 79px;
  background: url("genimg/sprites-wehqi.png") 0px 0px;
}

Available commands

$ wt -h

wt is a Sass project tool made to handle large projects. It uses the libSass compiler for efficiency and speed.

Usage:
  wt [flags]
  wt [command]

Available Commands:
  serve       Starts a http server that will convert Sass to CSS
  compile     Compile Sass stylesheets to CSS
  watch       Watch Sass files for changes and rebuild CSS

Flags:
  -b, --build="": Path to target directory to place generated CSS, relative paths inside project directory are preserved
      --comment[=true]: Turn on source comments
  -c, --config="": Temporarily disabled: Location of the config file
      --cpuprofile="": Go runtime cpu profilling for debugging
      --css-dir="": Compass backwards compat, does nothing. Reference locations relative to Sass project directory
      --debug[=false]: Show detailed debug information
  -d, --dir="": Path to locate images for spriting and image functions
      --font=".": Path to directory containing fonts
      --gen=".": Path to place generated images
      --images-dir="": Compass backwards compat, use -d instead
      --javascripts-dir="": Compass backwards compat, ignored
      --no-line-comments[=false]: UNSUPPORTED: Disable line comments
  -p, --proj="": Path to directory containing Sass stylesheets
      --relative-assets[=false]: UNSUPPORTED: Make compass asset helpers generate relative urls to assets.
      --sass-dir="": Compass backwards compat, use -p instead
  -s, --style="nested": nested style of output CSS
                        available options: nested, expanded, compact, compressed
      --time[=false]: Retrieve timing information
  -v, --version[=false]: Show the app version

Use "wt [command] --help" for more information about a command.

Try before you buy

You can try out Wellington on Codepen, fork the Wellington Playground! This live example has images you can use, or you can bring your Sass.

There are many examples on Codepen just see the Wellington collection

Installation

Wellington can be installed via brew

brew install wellington
wt -h

Building from source

Install Go and add $GOPATH/bin to your $PATH. Detailed instructions. Wellington requires Go 1.3.1+.

go get -u github.com/wellington/wellington/wt

# You should now have wt in your path
wt -h

Or, use wellington from a docker container

docker run -v $(pwd):/data -it drewwells/wellington wt compile proj.scss

Documentation

Why?

Sass is a fantastic language. It adds a lot of power to standard CSS. If only our clients were happy with the functionality that Sass provided. For the life of Sass, there has been only one tool that attempted to extend Sass for everything that's needed to build a site. While Ruby is great for development, it does have some drawbacks. As our Sass powered website grew, Compass and Ruby Sass started to become a real drag on build times and development happiness. A typical build including transpiling Sass to CSS, RequireJS JavaScript, and minfication of CSS, JS, and images would spend half the time processing the Sass.

There had to be a better way. Libsass was starting to gain some traction, but it didn't do everything we needed. So I wrote Wellington to be a drop in replacement for the spriting functions familar to those used to Compass. This makes it super simple to swap out Compass with Wellington in your Sass projects.

See how the sausage is made

Testing

make test

Profiling

make profile

Set your fork as the origin.

cd $GOPATH/src/github.com/wellington/wellington
git remote rm origin
git remote add origin [email protected]:username/wellington.git

Build a Docker Container. The wt container is 33.6 MB in size, but builds in a much larger container 844.7 MB.

make build
make docker #launch a container

Please use pull requests for contributing code. CircleCI will automatically test and lint your contributions. Thanks for helping!

Getting Help

Ask questions in the QA forum on Google Group

License

Wellington is licensed under MIT.

Bitdeli Badge

Owner
Wellington
Spriting applications for sass
Wellington
Comments
  • sometimes breaks with :nth-child

    sometimes breaks with :nth-child

    There is a really weird thing happening when I'm using grunt to call wellington to build my sass files there is a few records where I am getting in the resulting css :nth-child(2, 2) instead of :nth-child(2)

    this is part of the block I have an LI tag with this sass defined which should read if 2nd or 3rd or 4th or 5th element or has the class .is-expanded

    &.is-leaf:nth-child(2), &.is-leaf:nth-child(3), &.is-leaf:nth-child(4), &.is-leaf:nth-child(5), &.is-expanded {
    	@media (max-width:960px) {
    		display: none
    	}
    	a.active {
    		@media (min-width:500px) {
    			font-weight: 500;
    		}
    	}
    }
    
    

    now interestingly if I change it to the following

    &.is-leaf,&.is-expanded {
    	&:nth-child(2), 
    	&:nth-child(3), 
    	&:nth-child(4), 
    	&:nth-child(5), 
    	{
    		@media (max-width:960px) {
    			display: none
    		}
    		a.active {
    			@media (min-width:500px) {
    				font-weight: 500;
    			}
    		}
    	}
    }
    

    the output is now

    @media (max-width: 960px) {
            header .block-menu ul.menu li.is-leaf:nth-child(2, 2, 2, 2), header .block-menu ul.menu li.is-leaf:nth-child(3, 3, 3, 3), header .block-menu ul.menu li.is-leaf:nth-child(4, 4, 4, 4), header .block-menu ul.menu li.is-leaf:nth-child(5, 5, 5, 5), header .block-menu ul.menu li.is-expanded:nth-child(2, 2, 2, 2), header .block-menu ul.menu li.is-expanded:nth-child(3, 3, 3, 3), header .block-menu ul.menu li.is-expanded:nth-child(4, 4, 4, 4), header .block-menu ul.menu li.is-expanded:nth-child(5, 5, 5, 5), #main-menu ul.menu li.is-leaf:nth-child(2, 2, 2, 2), #main-menu ul.menu li.is-leaf:nth-child(3, 3, 3, 3), #main-menu ul.menu li.is-leaf:nth-child(4, 4, 4, 4), #main-menu ul.menu li.is-leaf:nth-child(5, 5, 5, 5), #main-menu ul.menu li.is-expanded:nth-child(2, 2, 2, 2), #main-menu ul.menu li.is-expanded:nth-child(3, 3, 3, 3), #main-menu ul.menu li.is-expanded:nth-child(4, 4, 4, 4), #main-menu ul.menu li.is-expanded:nth-child(5, 5, 5, 5) {
              display: none; } }
    
    

    compass watch will build this correctly

  • Return from sprite-map() is a string instead of a map or list

    Return from sprite-map() is a string instead of a map or list

    In attempting to debug why sprite-position() doesn't work, I ran into this:

    $foo: sprite-map("new/hidpi/*.png", $spacing: 12px);
    @debug type-of($foo);
    @debug $foo;
    

    upon running the code

    www/gui/sass/main.scss:4: DEBUG: string
    www/gui/sass/main.scss:4: DEBUG: new/hidpi/*.png12
    
  • wellington watch does not work when files edited by osx apps

    wellington watch does not work when files edited by osx apps

    I successfully set up a wellington and use file watcher with wt watch file.scss

    Everything is fine when I edit the file in terminal(echo, mcedit, nano), it triggers a rebuild. But if I edit the file from webstorm or osx's texteditor then nothing happens. For example editing that specific file textEdit, webstorm immediately ask for reload because the file changed, but wt ignores that.

    Another strange issue if I edit the file with vi then the following printed by wt: rebuild error: partial map lookup failed: file.scss.swp So I think something is wrong with the file watcher atm.

    Using OSX El Captain. Other tools like grunt-watch, node-sass's watch, compass watch, sass watch, etc is just working fine.

  • Support running in background

    Support running in background

    I would like to be able to use wellington with make so that I can grab a PID and start/stop along when I build my project. Currently if I try to force into background with & it will not continue to watch, though the PID is setup fine. Maybe this is a limitation of fsnotify?

  • Cannot build from source

    Cannot build from source

    Hello, I got the following error when attempting to go get:

    $ go get -u github.com/wellington/wellington
    # github.com/wellington/go-libsass
    could not determine kind of name for C.Sass_Function_Entry
    could not determine kind of name for C.Sass_Function_Fn
    could not determine kind of name for C.Sass_Function_List
    could not determine kind of name for C.sass_context_get_included_files_size
    
    clang errors for preamble:
    wellington/go-libsass/context.go:7:64: error: unknown type name 'Sass_Function_Entry'
     union Sass_Value* CallSassFunction( union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Options* opts ) {
                                                                   ^
    1 error generated.
    

    For reference:

    $ go version
    go version go1.4.2 darwin/amd64
    
    $ go env
    GOARCH="amd64"
    GOBIN=""
    GOCHAR="6"
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    GOPATH="/Users/ysimonson/go"
    GORACE=""
    GOROOT="/usr/local/Cellar/go/1.4.2/libexec"
    GOTOOLDIR="/usr/local/Cellar/go/1.4.2/libexec/pkg/tool/darwin_amd64"
    CC="clang"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
    CXX="clang++"
    CGO_ENABLED="1"
    

    ~/go/src/github.com/wellington/go-libsass/libsass-src is empty, so I suspect it's trying to statically link against my brew installed version of libsass.

  • Create a new release

    Create a new release

    Hello, wellington is no longer buildable in Homebrew with latest v1.0.4 release.

    ==> go build -ldflags -X github.com/wellington/wellington/version.Version=1.0.4 -o /usr/local/Cellar/wellington/1.0.4/bin/wt wt/main.go
    # github.com/wellington/wellington/vendor/github.com/fsnotify/fsevents
    vendor/github.com/fsnotify/fsevents/fsevents.go:38:31: constant 36893488147419103231 overflows uint64
    vendor/github.com/fsnotify/fsevents/fsevents.go:236:37: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCString
    vendor/github.com/fsnotify/fsevents/fsevents.go:237:16: cannot use cPaths (type _Ctype_CFArrayRef) as type _Ctype_CFMutableArrayRef in assignment
    vendor/github.com/fsnotify/fsevents/fsevents.go:240:33: constant 36893488147419103231 overflows _Ctype_ulonglong
    

    I believe latest commits made to master branch fix those issues.

  • New release?

    New release?

    We're shipping the latest release of wellington in Homebrew, but now it doesn't build anymore since it's not compatible with latest go (while master is). Could you please cut a new release?

  • Multiple-selector mixins don't apply correctly with placeholder extends

    Multiple-selector mixins don't apply correctly with placeholder extends

    This one is a little complicated, but I confirmed the behavior against sassc 3.2.5. I suspect it may have something to do with libsass: 3.2.5-155-g295b specifically.

    The Sass code in this gist should render CSS that applies to each of the input types, as shown in the sample output.

    https://gist.github.com/andystalick/aeca39897266c19f0455

  • Colorize warning and errors in output

    Colorize warning and errors in output

    It would be nice if warnings and errors were colorized in the build output. Hopefully that would pipe through to grunt-wellington as well.

    • [x] errors
    • [ ] warnings
  • Document command line invocation

    Document command line invocation

    This might sound really stupid, but I haven't been able to get wt to build files where I want. This is on 0.9.1, OS X.

    File structure:

    project
     - scss
       - libraries
       - style.scss
     - static
    

    libraries contains a bunch of subfolders with includes. With a shell in project I can't make wt output to static.

    I've tried this: wt -b=static/ -p=scss/libraries/ scss/style.scss (and lots of other combinations), but no luck. Can you add examples to the README that explain how to do this?

    Much appreciated!

  • Use Node instead of Go

    Use Node instead of Go

    Overall installation process looks a bit tricky because of the Go dependence.

    Why don't you use node.js (or io.js) instead of Go lang?

    Node would make Wellington much more portable, especially for the apps like (prepros.io)[Prepros] and (https://incident57.com/codekit/)[Codekit].

  • wt [1.0.4] exit code is `success` when compile on a file that doesn't exist (error printed

    wt [1.0.4] exit code is `success` when compile on a file that doesn't exist (error printed "invalid file found")

    If you run wt compile on a file that doesn't exist, the exit code is 0 (success) although it prints the error "invalid file found".

    Example:

    # compile an imaginary file
    $ wt compile any_random_name_here
    
    > invalid file found: any_random_name_here
    > 2019/12/30 23:24:06 Compilation took: 1.619ms
    
    # print exit code
    $ echo $?
    
    > 0
    

    Using:

    wt: 1.0.4
    libsass: 3.3.6
    

    Issue #85 is similar, but doesn't cover the case when the file is missing

  • invalid file found

    invalid file found

    The following works just fine:

    node-sass scss/index.scss > static/css/index.css
    node-sass scss/article.scss > static/css/article.css
    node-sass scss/archive.scss > static/css/archive.css
    node-sass scss/tags.scss > static/css/tags.css
    

    Using wellington

    wt watch -p scss -b static/css \
        index.scss \
        article.scss \
        archive.scss \
        tags.scss \
    

    I get

    invalid file found: tags.scss
    invalid file found: index.scss
    invalid file found: article.scss
    invalid file found: archive.scss
    File watcher started use `ctrl+d` to exit
    2018-06-12 17:26 wt[82411] (FSEvents.framework) FSEventStreamCreate: _FSEventStreamCreate: ERROR: could not allocate 0 bytes for array of path strings
    2018-06-12 17:26 wt[82411] (FSEvents.framework) FSEventStreamScheduleWithRunLoop(): failed assertion 'streamRef != NULL'
    
    2018-06-12 17:26 wt[82411] (FSEvents.framework) FSEventStreamStart(): failed assertion 'streamRef != NULL'
    

    Turns out it needs to be:

    wt watch -p scss -b static/css \
        scss/index.scss \
        scss/article.scss \
        scss/archive.scss \
        scss/tags.scss \
    

    which is not exactly clear from the docs. And the error message is also misleading.

    I am using

    $ wt -v
       libsass: 3.3.6
    Wellington: 1.0.4
    
  • Problem compiling using bundled libsass

    Problem compiling using bundled libsass

    System: Fedora 28

    $ go get -u github.com/wellington/wellington/wt
    # github.com/wellington/wellington/vendor/github.com/wellington/go-libsass/libs
    In file included from unity.cpp:22:
    ../libsass-build/json.cpp:49: warning: "out_of_memory" redefined
     #define out_of_memory() do {                    \
     
    In file included from ../libsass-build/ast.hpp:52,
                     from ../libsass-build/ast.cpp:2,
                     from unity.cpp:4:
    ../libsass-build/util.hpp:15: note: this is the location of the previous definition
       #define out_of_memory() do {            \
     
    
  • Compile error if used @import blocks

    Compile error if used @import blocks

    When using block import, the compiler refuses to compile the sources with the following error:

    @charset 'utf-8'
    
    @import
      grid/grid,
      grid/__column/grid__column,
      grid/__column/_size/grid__column_size,
      ...
      grid/__row/grid__row
    

    Output:

    $ wt watch ./src/ -b ./dist/
    2018/03/22 13:21:43 Error > :0
    basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 7)
    
Mocking your SQL database in Go tests has never been easier.

copyist Mocking your SQL database in Go tests has never been easier. The copyist library automatically records low-level SQL calls made during your te

Dec 19, 2022
Embed arbitrary resources into a go executable at runtime, after the executable has been built.

ember Ember is a lightweight library and tool for embedding arbitrary resources into a go executable at runtime. The resources don't need to exist at

Nov 9, 2022
go-ima is a tool that checks if a file has been tampered with. It is useful in ensuring integrity in CI systems
go-ima is a tool that checks if a file has been tampered with.  It is useful in ensuring integrity in CI systems

go-ima Tool that checks the ima-log to see if a file has been tampered with. How to use Set the IMA policy to tcb by configuring GRUB GRUB_CMDLINE_LIN

Apr 26, 2022
Instagram API has been solely programmed on Go
Instagram API has been solely programmed on Go

Instagram-API This API has been solely programmed on Go, and for database storage MongoDB has been used. This is originally done as a part of a techni

Feb 6, 2022
This api has been built according to the task assigned by Apponity.
This api has been built according to the task assigned by Apponity.

Appointy_Task This api has been built according to the task assigned by Apponity. All the tasks Provided have been completed Link to the Document of t

Oct 10, 2021
Provides a rest API that used to count how many times a certain repository of your github has been cloned.
Provides a rest API that used to count how many times a certain repository of your github has been cloned.

traffic-clones-api An apiserver for https://shields.io/endpoint. Description Provides a rest API that used to count how many times a certain repositor

Dec 19, 2021
Run this bot on machine where your qbittorrent has been installed

Telegram bot for qbittorrent Run this bot on machine where your qbittorrent has been installed. Qbittorrent settings Activate Web Interface or use hea

Jan 13, 2022
check if new episodes of anime has been released from you're terminal
check if new episodes of anime has been released from you're terminal

checkanime Check if new episodes of you're favourite anime has been released from you're terminal Installation Make sure $GOPATH/bin is added to PATH

Jan 20, 2022
Go API backed by the native Dart Sass Embedded executable.

This is a Go API backed by the native Dart Sass Embedded executable. The primary motivation for this project is to provide SCSS support to Hugo. I wel

Jan 5, 2023
Minimal bundling for projects that require generation (e.g. SASS to CSS)

staticgen staticgen is a tool that generates file bundles and watches directories for changes. Configuration Project configurations are specified in t

Dec 14, 2021
Inspired by Have I Been Pwnd
Inspired by Have I Been Pwnd

Have I Been Redised Check it out at RedisPwned and Have I Been Redised How it works We scan the internet for exposed Redis databases broadcasting to t

Nov 14, 2021
Scrappy is a cli tool that allows multiple web scrappers to monitor periodically for a basic ruleset coverage and inform users when the criteria have been met.

Scrappy - A multi-type web scrapper with alerting Scrappy is a cli tool that allows multiple web scrappers to monitor periodically for a basic ruleset

Nov 7, 2021
The standard library flag package with its missing features

cmd Package cmd is a minimalistic library that enables easy sub commands with the standard flag library. This library extends the standard library fla

Oct 4, 2022
Go's missing DateTime package

Go's standard library contains a single date package - time. The type provided by it, Time, contains date, time and location information.

Nov 19, 2022
All the missing AMD64 atomic instructions

atomics All the AMD64 atomic instructions, exposed as Go functions: ⚠️ PRE-ALPHA ⚠️ Features LOCK {ADD,ADC,AND,BTC,BTR,BTS,CMPXCHG,CMPXCH8B,CMPXCHG16B

Sep 20, 2021
DNSTake — A fast tool to check missing hosted DNS zones that can lead to subdomain takeover
DNSTake — A fast tool to check missing hosted DNS zones that can lead to subdomain takeover

DNSTake — A fast tool to check missing hosted DNS zones that can lead to subdomain takeover

Dec 28, 2022
Analyse binaries for missing security features, information disclosure and more.
Analyse binaries for missing security features, information disclosure and more.

extrude Analyse binaries for missing security features, information disclosure and more. ?? Extrude is in the early stages of development, and current

Dec 16, 2022
Domo is a Discord bot to help you manage your FOMO (fear of missing out).

domo domo is a Discord bot to help you manage your FOMO (fear of missing out). Development Download and install Go: Instructions To run the bot first

Jan 4, 2022
The missing git branch --interactive

git branch-i I got cross that there's no git branch --interactive, so I made this. It's a very (very) simple curses-mode git branch/git checkout alter

Nov 2, 2022