docpad / docpad-plugin-sass

Adds support for the SASS and SCSS CSS pre-processors to DocPad. It also supports the Compass framework.
Other
13 stars 6 forks source link

Randomly doesn't render SCSS #10

Closed greduan closed 11 years ago

greduan commented 11 years ago

@balupton And all involved. :smile: 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 :wink:).

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

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

balupton commented 11 years ago

When a sass file is changed, we will re-render all the sass files. It could be that we open too many processes at once and sass kicks the bucket for whatever reason.

If that hypothesis is correct, these solutions come to mind:

  1. Reduce the amount of allowed processes at once
  2. Make the sass rendering a serial queue, rather than a parallel one
  3. Does sass combine imports? If so, then we could only render non-import sass files, reducing the rendering time ten-fold.

By combining imports I mean:

@import 'a'
@import 'b'

becomes:

/* whatever was inside a */
/* whatever was inside b */
greduan commented 11 years ago

@balupton Thanks for your answer. :)

When a sass file is changed, we will re-render all the sass files. It could be that we open too many processes at once and sass kicks the bucket for whatever reason.

That may be correct... I am running the following plugins:

Plugins: datefromfilename, eco, livereload, marked, partials, sass, sitemap
  • Reduce the amount of allowed processes at once
  • Make the sass rendering a serial queue, rather than a parallel one

How would I accomplish both of these?

Does sass combine imports? If so, then we could only render non-import sass files, reducing the rendering time ten-fold.

Yes it does combine imports AFAIK. However I only have 1 SCSS file...

balupton commented 11 years ago

However I only have 1 SCSS file

Okay, then that is very very very strange.

greduan commented 11 years ago

@balupton Would some system specs help? I have 2GB of RAM, a 2.0GHz Intel Core 2 Duo processor. I usually have around 300MB of RAM available at all times...

And here's docpad run's output:

eduan@arch:/srv/http/docpad $ docpad run
info: Welcome to DocPad v6.38.1
info: Plugins: datefromfilename, eco, livereload, marked, partials, sass, sitemap
info: Environment: development
info: DocPad listening to http://localhost:9778/ on directory /srv/http/docpad/out
info: LiveReload listening to new socket on channel /docpad-livereload with log level 1
info: Generating...
info: Skipped ignored file: portfolio/index.html
warning: 
  Rendering the extension "js" to "min" on "scripts/adapt.min.js" didn't do anything.
  Explanation here: http://docpad.org/extension-not-rendering
info: Generated all 20 files in 2.894 seconds
info: Watching setup starting...
info: Watching setup
info: The action completed successfully
^C

The last five lines are what you find when the styles stop rendering.

I want to point out that sometimes, rare though, I have to stop docpad run and start it again twice or more in order for it to start working.

greduan commented 11 years ago

@balupton OK got some more info with some more developing.

It seems I don't have to restart DocPad in order for it to render, some times it just decides to render correctly.

I have also disabled/uninstalled the datefromfilename and sitemap plugins. Which doesn't seem to make a difference.

I'll try changing it to a SASS file now, instead of SCSS...

greduan commented 11 years ago

OK so a SASS file did not help the situation... I also disabled the livereload plugin, see if that makes a difference.

It does not... Any more ideas? It is really annoying to develop like this, since it doesn't allow me to develop to start with. :wink:

greduan commented 11 years ago

I'd like to point out that, while not ideal, I've found a work-around.

I've disabled the SASS plugin, and I've been compiling the SCSS manually using a ST2 plugin, while we solve this. :)

greduan commented 11 years ago

@balupton Well I haven't been able to find a real solution to the problem, however I did switch to Stylus instead and I can confirm that this does not happen with the Stylus plugin.

So it might just be a SASS plugin only thing. :)

balupton commented 11 years ago

Seems this could be the cause of this problem: https://github.com/balupton/bal-util/pull/9

greduan commented 11 years ago

Excellent! Currently I'm using Stylus but now I know I can use SASS. :)

balupton commented 11 years ago

Should be fixed with the latest docpad v6.40.0 and the latest plugin version v2.5.0, I've done some improvements in this area. Closing, happy to re-open :)

greduan commented 11 years ago

@balupton Excellent! Thanks for everything. :)

Whenever I get a chance I'll try it out. Might be a long while though. ;)