Comments (10)
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.
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.
I've seen strange results when compiling this files.
Count of remove/create sprite is equal of sprite_images() calls.
from gulp-compass.
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.
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.
Note: tried fix from idflood and seems to be working for me.
from gulp-compass.
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.
I've forked this and made some small changes which implement the changes mentioned above. The relevant commits are:
- https://github.com/jacksleight/gulp-compass/commit/0f2ca82343e32312dd1f75e5923d849a5a1dc666 Disable file in exec command
- https://github.com/jacksleight/gulp-compass/commit/fc4c3a5bc26553ba19c2abf16897f71fa29a7d26 Prevent task from executing on more than one file
- https://github.com/jacksleight/gulp-compass/commit/4f2dda3a469250cf87793b9d6f1dcd8587736ac8 Give skipped files the correct extension
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.
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.
@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)
- Fails to pick up changes from gulp-watch HOT 3
- When assigning a css directory, the gulp.dest folder get's ignored. HOT 5
- After configuration gulpfile.js with plumper I got this error:
- 看看这个问题
- Two files exported when trying to rename filename. HOT 3
- How do you set image path without config.rb? HOT 1
- Sourcemaps not ending up in the stream
- gulp-compass - Not work HOT 1
- gulp-compass is not working in the gulp's stream paradigm HOT 4
- gulp-compass ignores gulpfile and does not update css folders when they're changed
- Error in plugin 'gulp-compass' HOT 1
- compass.rb on project directory
- "end" event
- Together with gulp-rev and gulp-sourcemaps
- Error when importing file (File to import not found or unreadable:)
- Nested rgba() inside of other function looses transparency HOT 1
- Can't make it work via config.rb
- Partials inside subfolders not getting compiled HOT 1
- "It's not clear which file to import"
- gulp-util
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-compass.