Giter VIP home page Giter VIP logo

Comments (10)

dmp42 avatar dmp42 commented on June 1, 2024

Indeed, it does compile every time it is called.
What command would you expect instead of "compile"? (http://compass-style.org/help/tutorials/command-line/)
If you are thinking about "watch", then this is not the correct way to proceed (one should rather use gulp-watch and trigger compass compile from there).

from gulp-compass.

wholcman avatar wholcman commented on June 1, 2024

When compass does compile, it shouldn't say every time that the sprite was removed and recreated because no images were added. It should say "unchanged".
When we use only compass compile or watch, compass say "unchanged" but with a gulp default task no.

from gulp-compass.

megakote avatar megakote commented on June 1, 2024

I've seen strange results when compiling this files.
Count of remove/create sprite is equal of sprite_images() calls.
20140121_w1uhauowu9

from gulp-compass.

idflood avatar idflood commented on June 1, 2024

I have reproduced the same issue, and while trying to figure out the differences with the grunt counterpart I've found that this plugin add much more options to the command line.

In fact grunt-contrib-compass will run something like compass compile --time while gulp-compass will run compass compile /project/path /project/path/to/file.sass.

So I tried to comment the options.push(file_path); in gulp-compass and now the sprite is only created once. Now, I don't know if there is a good reason for this so I didn't made a pull request.

By the way, the project also compile without problem when commenting the options.push(opts.project) just above but this is out of scope.

from gulp-compass.

boldfacedesign avatar boldfacedesign commented on June 1, 2024

Does the gulp-compass module run 'compass compile' every time? If so this will be the cause of the issue. If you look through the Ruby files of the Compass gem you will see the 'compile' and 'watch' task are doing different things.
'compass compile' will start a new compilation of your project from scratch and create a new compiler instance and re-referencing your config.rb file, essentially starting with a clean slate. Thus sprites will be regenerated.
'compass watch' is a much more complex process which I haven't as yet been able to fully de-construct and understand. From what I could gather I believe the compiler is not re-instantiated. I found this out when trying to run a ' on_stylesheet_saved do |file| ' task at the bottom of my config.rb file. The task would run each time with 'compass compile' but when running 'compass watch' the task would execute once on instantiation then each subsequent SASS compile would not run my task. Like I say I think this is because the compiler is not re-instantiated when using 'watch'.
Hope this helps.

from gulp-compass.

boldfacedesign avatar boldfacedesign commented on June 1, 2024

Note: tried fix from idflood and seems to be working for me.

from gulp-compass.

jacksleight avatar jacksleight commented on June 1, 2024

I think I know the cause of this issue, at least for me:

  • My gulp task is configured to run on all SCSS files (excluding partials).
  • There are two SCSS files.
  • Because there are two files, gulp-compass executes twice, once for each file.

BUT, Compass can't really run like this when working with sprites. If you have a universal Compass sprite config that is used by multiple "entry-point" SCSS files, and then try to execute two instances of Compass to parse these files separately, each instance will "fight" over the sprite image, continually removing and replacing the image that the other instance generated.

For this reason it's best to ensure that only one Compass instance runs (pipe in one source file), and then remove the file option from the exec command (@idflood's fix), so that Compass runs on the whole project folder in one go, generating the sprite image once.

from gulp-compass.

jacksleight avatar jacksleight commented on June 1, 2024

I've forked this and made some small changes which implement the changes mentioned above. The relevant commits are:

This probably isn't a perfect solution, in fact it may be the wrong approach entirely, but I don't know how else to handle it given the way Compass generates sprites. I assume there could also be problems with subsequent tasks getting run on the skipped files before Compass has finished running.

from gulp-compass.

mcmillion avatar mcmillion commented on June 1, 2024

Removing the options.push(file_path); prevents any images from being generated for me.

I'm sourcing a single site.scss file that imports all the other Sass partials in our project. Despite only one of these files setting up the sprites and only a few of them actually utilizing the sprite classes, every single @import statement triggers another sprite generation.

from gulp-compass.

rehorn avatar rehorn commented on June 1, 2024

@idflood, your fix, sprite getting regenerated for one time, but never trigger regenerated sprite images when adding or removing images

from gulp-compass.

Related Issues (20)

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.