Git Product home page Git Product logo

docpad-plugin-sass's Introduction

SASS/SCSS Plugin for DocPad with Compass support

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Adds support for the SASS and SCSS CSS pre-processors to DocPad. It also supports the Compass framework.

This SASS/SCSS plugin uses the original ruby implementation, which requires installing ruby and the necessary gems. If you would like to use a native node implementation which would be faster (but no support for 3rd party ruby gems like compass etc) then we'd recommend using the nodesass plugin. More info here.

Convention: .css.(sass|scss). Make sure that you your files are located in documents (or render) folder as extensions-based rendering happens only inside this folder.

Install

  1. Install Ruby

  2. Install the SASS gem

  3. Optional: Install the Compass gem

  4. Install this plugin

    docpad install sass
    

Configure

For information on customising your plugin configuration you can refer to the DocPad FAQ

Sass and Scss Paths

We automatically detect the path to your sass and scss executables, however sometimes that doesn't work and you will get ENOENT errors. If our detection fails and you'll have to manually specify the path to your sass and scss executables with the sassPath and scssPath config options, more info here.

Compass Support

We automatically detect if you have compass installed, and if you do, then we'll use it. If our detection fails and you want to still use it, then set the compass option to true. If you have compass installed but don't want to use it then set the compass option to false.

Output Style

You can set the outputStyle option to any of the supported output styles. Those being nested, expanded, compact, and compressed. By default, we use the compressed mode for all environments, except the development mode where it is set to expanded.

Require Libraries

You can set the requireLibraries option to an array of extra ruby libraries you'd like to include before rendering your sass file. For instance, setting it to ['susy','compass-colors'] will include the Susy and Compass Colors plugins. By default, the value is set to null indicating we do not include any libaries.

Render Underscore Stylesheets

By default we prevent any SASS/SCSS stylesheets that filename starts with underscore character from being rendered and written to the output directory. This is to follow SASS/SCSS convention that such files are just intended to be included inside out stylesheets, and that they are not meant to be rendered by themselves. If you really want to, you can render the underscore stylesheets by setting the renderUnderscoreStylesheets option to true in your plugin's configuration.

Sourcemaps

If you want to use sourcemaps, set the sourcemap option to true.

Bundlr Support

If you want to use bundler you can set something like this in docpad.coffee:

	plugins:
		sass:
			scssPath: ['bundle','exec','scss']
			sassPath: ['bundle','exec','sass']

Troubleshooting

I get ERROR: Cannot load compass.

Install compass again using: gem install compass --pre

History

Discover the release history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are:

and licensed under:

docpad-plugin-sass's People

Contributors

0x6a68 avatar andruhon avatar balupton avatar iammerrick avatar jankolkmeier avatar moperacz avatar neilbaylorrulez avatar patocallaghan avatar thuongdinh avatar

Stargazers

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

docpad-plugin-sass's Issues

Specify path to compass?

Hi, I'm trying to deploy a site that uses this to Bluemix, which is basically IBM's version of Heroku.

It's using a node.js buildpack, so it automatically installs things from package.json, but ignores the Gemfile.

Next, I tried changing the start command gem install compass && node server.js, but it choked because the gems directory is read-only. (But the good news is that ruby is installed).

After that, I copied the ruby gems into my app and configured the sassPath and scssPath options - that got me even further, but it choked when I tried to find compass in the system ruby gems directory.

So, is there a way to specify the path to compass in addition to sass and scss? Or, any other way you can think of to solve this?

.css files not being generated

Hey,

I'm not sure if it's something straightforward I'm not doing correctly but I can't seem to get it to generate .css files from .scss files.

I was originally getting the error from #7 but then followed the instructions for adding the config below and it then went on to generate the out files.

sass:
    sassPath: 'c:/Ruby193/bin/sass.bat'
    scssPath: 'c:/Ruby193/bin/scss.bat'
    compass: true

I have a style.css.scss in files/css which includes lots of .scss files, but when I save it all it does is copy all the .scss files to out. No style.css is created.

I've got a log file here if you want to look and see if anything is out of the ordinary. If you do a search for 21:05 that will be where I saved the style.css.scss file.

I'm on Windows 7, node 0.10.4, docpad 6.34.2, docpad-plugin-sass ~2.4.5.

Thanks,
Pat

Move to node-sass from the Ruby application

@balupton
Thought it might be worth asking for an update that switches to node-sass. node-sass uses the C version of the SASS compiler (also by the original SASS creator), instead of the Ruby version. So it makes it a much quicker compile process.

Perhaps I can look into forking this and making a pull request with this already integrated?

Native sass

I migrated from Middleman to DocPad specifically to be able to drop Ruby dependencies! There's a (semi) native javascript node-sass library. Why does DocPad use the original implementation instead of node-sass?

Docpad Sass Plugin Error

Hey there, I'm getting this error when running 'docpad run' now.. wondering if anyone has some idea whats going on.

$ docpad run
info: Welcome to DocPad v6.64.2 (local installation: /Users/zachfrank/Dev/mm/node_modules/docpad)
info: Contribute: http://docpad.org/docs/contribute
info: Plugins: eco, livereload, sass
info: Environment: development
info: DocPad listening to http://0.0.0.0:9778/ on directory /Users/zachfrank/Dev/mm/out
info: LiveReload listening to new socket on channel /docpad-livereload
info: Generating...
warning: Something went wrong while rendering: styles/app.css.scss
exited with a non-zero status code
error: Something went wrong with the action
error: An error occured: 
Error: exited with a non-zero status code
  at ChildProcess. (/Users/zachfrank/Dev/mm/node_modules/docpad-plugin-sass/node_modules/safeps/out/lib/safeps.js:165:23)
  at ChildProcess.EventEmitter.emit (events.js:98:17)
  at maybeClose (child_process.js:743:16)
  at Socket. (child_process.js:956:11)
  at Socket.EventEmitter.emit (events.js:95:17)
  at Pipe.close (net.js:465:12)

info: Shutting down... cya next time!

Here's my installed gems if that's any help.. wondering if I have the wrong version of sass?

*** LOCAL GEMS ***

bourbon (4.0.0)
bundler (1.6.2)
chunky_png (1.3.0)
compass (0.12.6)
foundation (1.0.4)
fssm (0.2.10)
neat (1.6.0)
sass (3.3.5, 3.2.19)
thor (0.19.1)

Compass config file ignored

I am migrating my working Yeoman project to DocPad. The project uses heavily Compass sprite feature. I copied the working config.rb file to the DocPad project root. To me it looks like that config.rb is being ignored.

In the main.css.scss file I have following lines that are giving an error:
@import 'icons/*.png';
@include all-icons-sprites;

It's very much like in the Compass documentation (http://compass-style.org/help/tutorials/spriting/)

The error indicates that the paths are not incorrect somehow.

Error: Syntax error: File to import not found or unreadable: icons/*.png.
Load paths:
c:/Users/ttamminen/Documents/Github/Node-Priima-valmennus
c:/Users/ttamminen/Documents/Github/Node-Priima-valmennus/src/documents/styles

It doesn't matter what I have in the Config.rb the error is always same. Any ideas how to debug this?

My folder structure is common DocPad style. Under images folder there are icons & sprites. Icons folder contains separate png files and sprites folder contains single image that has all icons combined.

+---out
| +---fonts
| | +---eot
| | +---otf
| | +---ttf
| | ---woff
| +---images
| | +---icons
| | ---sprites
| +---scripts
| | ---vendor
| ---styles
---src
+---documents
| +---fonts
| | +---eot
| | +---otf
| | +---ttf
| | ---woff
| +---images
| | +---icons
| | ---sprites
| +---scripts
| | ---vendor
| ---styles
| +---compass
| | +---css3
| | +---layout
| | +---reset
| | +---typography
| | | +---links
| | | +---lists
| | | ---text
| | ---utilities
| | +---color
| | +---general
| | +---links
| | +---lists
| | +---sprites
| | +---tables
| | ---text
| ---compass_twitter_bootstrap
+---files
---layouts

Randomly doesn't render SCSS

@balupton And all involved. 😄
I've run across a quite problematic problem.

For some reason it doesn't seem to render the SCSS sometimes.

I have a file named main.css.scss, of course it's contents are SCSS.

However I started running across the problem where my dev website will look like crap, no custom fonts, no custom colors, no layouts etc. And I've figured out the problem.

I run across this problem whenever I make certain changes to my SCSS file... Goes to check... Yep, I'm not sure what triggers the problem, I've noticed it happen when it changes something significant (like when my documents has structure changes) or when a change in the CSS is significant (I leave the definition of "significant" to the CSS 😉).

When I go to my trusty Chrome dev tools and I check the CSS file that's being loaded I find out that the CSS file (it is a .css file) is still a SCSS file. It's still got my variable definitions as such, (e.g. $black: #323232; etc.). So it's a SCSS file with the CSS extension.

What info do you need from me to fix this issue? Terminal doesn't output any errors BTW.

Also, the only way to fix this problem is to Ctrl+c (exit docpad run) and do docpad run again, then do a change to the SCSS file and it seems to re-generate correctly only then.

Thanks again, and look forward to a solution. 😄

P.S.: Yes I have Ruby installed and the Sass gem installed. 😉

Files with an underscore are rendered when there is a dash in the filename.

sass plugin 2.4.5:

When I create a file with an underscore it doesn't get rendered. This behavior is expected according to the Sass reference:

"If you have a SCSS or Sass file that you want to import but don’t want to compile to a CSS file, you can add an underscore to the beginning of the filename. This will tell Sass not to compile it to a normal CSS file. You can then import these files without using the underscore."

But if you create a file with an underscore and a dash the file still gets rendered. Example:

_file.css.scss // doesn't get rendered. Okay
_file-test.css.scss // gets rendered. Not okay

Error: This socket is closed.

info: Generating...
warning: You have multiple files being written to c:\Users\Michael\Desktop\MDM\C
lient Projects\StarDog.com\Development\Staging\stardog-docs\published\css\gumby.
css, they are:
  - c:\Users\Michael\Desktop\MDM\Client Projects\StarDog.com\Development\Staging
\stardog-docs\src\docs\css\gumby.css.scss
  - c:\Users\Michael\Desktop\MDM\Client Projects\StarDog.com\Development\Staging
\stardog-docs\src\files\css\gumby.css
  Rename one of them to avoid an over-write
warning: Something went wrong while rendering: css\gumby.css.scss
error: Something went wrong with the action
error: An error occured:
Error: This socket is closed.
    at Socket._write (net.js:618:19)
    at doWrite (_stream_writable.js:219:10)
    at writeOrBuffer (_stream_writable.js:209:5)
    at Socket.Writable.write (_stream_writable.js:180:11)
    at Socket.write (net.js:596:40)
    at c:\Users\Michael\Desktop\MDM\Client Projects\StarDog.com\Development\Stag
ing\stardog-docs\node_modules\docpad-plugin-sass\node_modules\safeps\out\lib\saf
eps.js:160:21
    at b (domain.js:183:18)
    at Domain.run (domain.js:123:23)
    at Task.<anonymous> (c:\Users\Michael\Desktop\MDM\Client Projects\StarDog.co
m\Development\Staging\stardog-docs\node_modules\docpad-plugin-sass\node_modules\
safeps\out\lib\safeps.js:125:18)
    at ambi (c:\Users\Michael\Desktop\MDM\Client Projects\StarDog.com\Developmen
t\Staging\stardog-docs\node_modules\docpad-plugin-sass\node_modules\taskgroup\no
de_modules\ambi\out\lib\ambi.js:21:27)
    at c:\Users\Michael\Desktop\MDM\Client Projects\StarDog.com\Development\Stag
ing\stardog-docs\node_modules\docpad-plugin-sass\node_modules\taskgroup\out\lib\
taskgroup.js:82:19
    at process._tickDomainCallback (node.js:459:13)
info: Shutting down... cya next time!

I'm new to using sass but this gumby.css.scss is trigger a error about sockets it seems?

I've followed all the instructions on the docpad-plugin-sass' readme, yet alas this error persists. I'm working in a windows development environment #fyi but I have a feeling(hope) that's not the issue.

Does not run on Windows with spaces in binary or output path

I ran into a little issue while trying to install DocPad with SASS support on a Windows machine. When executing DocPad there is an error thrown caused by the SASS plugin when trying to launch the compiler in a location something like C:\Program Files\ruby\rubygems\gem\sass.bat. The path is not correctly escaped and the plugin tries to run C:\Program. Same problem seems to apply when the path to the *.sass files contains spaces. As this is the default application folder in Windows, this seems not like an unusual scenario.

I've tried to modify line 97 of src/sass.plugin.coffee to look something like this:

command = [].concat(if safeps.isWindows() then execPath.replace(/ /g, '^ ') else execPath)

but this leads to a strange error sockets timeout.

An Error occured

I'm trying to use the plugin in my project but it keep it saying this error. I've already defined it manually and continuos error.

Error: spawn ENOENT
at errnoException (child_process.js:945:11)
at Process.ChildProcess._handle.onexit (child_process.js:736:34)
error: An error occured:
Error: spawn ENOENT
at errnoException (child_process.js:945:11)
at Process.ChildProcess._handle.onexit (child_process.js:736:34)
error: An error occured:
Error: spawn ENOENT
at errnoException (child_process.js:945:11)
at Process.ChildProcess._handle.onexit (child_process.js:736:34)

Docpad shuts down after a Sass syntax error

Hey,

can you tell me is it expected behaviour that Docpad should shut down if it detects a Sass error during generation? I'm finding at the moment that each time I get a syntax error I have to re-start Docpad each time.

warning: Something went wrong while rendering: assets\css\style.css.scss
Syntax error: Undefined variable: "$site-max-width--oldie".
        on line 203 of standard input
  Use --trace for backtrace.

error: Something went wrong with the action
error: An error occured:
Error: Syntax error: Undefined variable: "$site-max-width--oldie".
        on line 203 of standard input
  Use --trace for backtrace.

    at ChildProcess.<anonymous> (D:\Dev\Github\cssoff2013\node_modules\docpad-plugin-sass\node_modules\safeps\out\lib\safeps.js:159:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:451:12)
info: Shutting down... cya next time!

As you can imagine this messes up my workflow a bit but I can't imagine that this is expected?

I'm on the following:

  • Windows 7
  • Docpad 6.54.6
  • Sass Plugin 2.6.1
  • Node 0.10.10
  • Sass 3.2.10

Thanks,
Pat

@import susy (and others)

Hi guys,
I'm having trouble loading "susy" as well as other gems ,,, my docpad.coffee is simply:

docpadConfig = {
    plugins:
        sass:
            compass: true
            requireLibraries:['susy']      
}

then @import "susy"; at the top of my style.css.scss file
At docpad run I get

error: An error occured:
Error: Syntax error: File to import not found or unreadable: susy.
              Load paths:
                ~/Sites/kdocpad
               ~/Sites/kdocpad/src/documents/styles
               ~/Sites/kdocpad/sass
                ~/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/blueprint/stylesheets
               ~/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets
                Compass::SpriteImporter
        on line 1 of standard input
  Use --trace for backtrace.

    at ChildProcess.balUtilModules.spawn (~/Sites/kdocpad/node_modules/docpad-plugin-sass/node_modules/bal-util/out/lib/modules.js:97:19)
    at ChildProcess.EventEmitter.emit (events.js:99:17)
    at Process._handle.onexit (child_process.js:678:10)

docs

I'm new to docpad, trying to use this plugin. The docs don't explain where to actually put your scss files so they'll get picked up. An example of the configuration options would also be helpful.

Sass plugin doesn't work after DocPad update

I recently updated the DocPad and, suddenly, Sass plugin doesn't work anymore.

Version:
docpad: v6.55.8
docpad-plugin-sass: v2.6.1

I've done several tests and the CSS file isn't generated at all.

info: Generating...
info: Generated 0/7 files in 0.014 seconds
info: Regenerated at 13:52:29

And that is all. Any suggestions?

Specify image_dir

How is it possible to specify the directories for images, fonts etc that would normally be done using the config.rb?

Should I be including a config.rb when using this plugin?

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.