Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Recompiles all sass files with every build even if unchanged #111

Closed
chriseppstein opened this issue Aug 9, 2014 · 11 comments
Closed

Recompiles all sass files with every build even if unchanged #111

chriseppstein opened this issue Aug 9, 2014 · 11 comments

Comments

@chriseppstein
Copy link

By default, the sass --update command will only recompile those sass files which are newer (or have a dependency that is newer) than the output css file. However, it seems like the temp directories being used cause this to not work. Can you think of some way to preserve the optimized rebuild that sass usually performs (maybe copy the prebuilt css files to the temp output directory and set mtimes explicitly on them?), it can save a lot of time on large sass projects.

@robwierzbowski
Copy link
Contributor

We are setting the mtimes specifically, but it doesn't seem to be working exactly right. Can you explain the method Sass uses to cache more in depth?

@lagden
Copy link

lagden commented Aug 9, 2014

Taking the opportunity...

I am using Sass 3.4.0.rc.3 (Selective Steve) + Compass 1.0.0.rc.1 (Polaris)... and I have problem with path using gulp-ruby-sass 0.7.1

See the output using gulp-ruby-sass:

body{
  background-image: url('../../../../../../../Users/lagden/web/tex/nimble/dev/images/bg-2.jpg?1404357523');
}

Well... there is my task

gulp.task 'sass', ->
  gulp.src 'sass/{,*/}*.sass'
    .pipe sass
      trace         : true
      unixNewlines  : true
      compass       : true
      noCache       : true
    .pipe prefix AUTOPREFIXER_BROWSERS
    .pipe gulp.dest 'dev/dest'
    .pipe filter 'dev/dest/*.css'
    .pipe reload stream: true

Now, I am using spawn as workaround to generate css correctly

gulp.task 'compile', ->
  gulp.src 'sass/screen.sass', buffer: false
    .pipe spawn
      cmd: 'sass'
      args: [
        '--trace'
        '--no-cache'
        '--compass'
        'sass/screen.sass'
        'dev/css/screen.css'
      ]
    .pipe gulp.dest 'dev/css'

My config.rb

require 'compass/import-once/activate'
require 'bootstrap-sass'

project_type     = :stand_alone
environment      = :development
http_path        = './'
sass_dir         = "./sass"
css_dir          = "./dev/css"
fonts_dir        = "./dev/fonts"
images_dir       = "./dev/images"
javascripts_dir  = "./dev/js"
relative_assets  = true
preferred_syntax = :sass

Maybe be a bug or maybe is missing setting some property correctly...

Help?

@lilgast8
Copy link

Hi.

I have a similar issue.
I'm using Sass 3.4.0 (Selective Steve) + Compass 1.0.1 (Polaris) and gulp-ruby-sass 0.7.1.

Here is my task :

gulp.src(paths.src.css+'styles.scss')
        .pipe(plumber())
        .pipe(sass({
            style: 'compressed',
            compass: true
        }))
        .on('error', function(error) {
            console.log(error.message);
            return notify().write(error.message);
        })
        .pipe(rename('styles.min.css'))
        .pipe(gulp.dest(paths.assets.css));

And here is what my output file look like :
capture d ecran 2014-08-21 a 11 49 12
capture d ecran 2014-08-21 a 11 44 20

Any help are welcome.

@robwierzbowski
Copy link
Contributor

Please keep the issues on topic.

@lagden We still have some issues with sourcemap paths. My proposal to make the 1.0 version of this plugin a vinyl file source would make it similar to spawning, but would output into a gulp stream. If you have questions about the sourcemap issue please find an issue about sourcemaps and comment there, or open a new issue.

@lilgast8 The problem is Sass 3.4, sourcemaps, and the rename task. See the comment here for a fix: #113 (comment)

@robwierzbowski
Copy link
Contributor

Implementing the suggestion in #110 (comment) will get us closer to solving this problem.

@robwierzbowski
Copy link
Contributor

I see two paths to fix this.

  1. Rely on Sass's caching. Upside: caching is optimized for Sass in particular. Downside: we'd need a clear() function to clear the results between Sass tasks or when a source file is deleted.
  2. Use some sort of gulp incremental build task. Upsides: we'd have full control, no need for clear() function. Downsides: we'd lock people into one gulp way to build incrementally, more required options, more code and functionality to maintain.

I'm leaning towards 1. Opinions welcome.

@lagden
Copy link

lagden commented Jan 26, 2015

@robwierzbowski I left the Gulp... I feel more comfortable working with Grunt.
But I will make a test to confirm if is ok...

@philipbremer
Copy link

I like to be able to disable sass caching in my gulp-ruby-sass task. I use Sublime Text's GoTo Anything shortcut to search for files in my project and sass cache pollutes my file structure with similarly named .scss files.

That said, for larger projects with several large files, reducing compile time with incremental builds is more important that being able to disable sass caching.

@mattfelten
Copy link

If you use Sublime Text's Project feature, you can exclude the .sass-cache folder from the project.

@robwierzbowski
Copy link
Contributor

Fixed, will be released in 2.0.

@robwierzbowski
Copy link
Contributor

Fixed with #260.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants