Comments (14)
Aha! Thanks for the pointer, I managed to work around this oddity for now using 2 separate tasks as follows.
In task 1, I purely compile the scss
to css
using compass
and setting the compass css_dir
to a .tmp
folder.
Then in task 2, I gulp.src
the .tmp
files and work with them, writing the output back into the actual assets/css
folder.
Not particular nice or clean, but it does seem to work for now.
// Work with our SCSS files.
gulp.task('compass', function() {
gulp
.src('assets/scss/**.scss')
.pipe( tasks.compass( { config_file: './config.rb' } ) )
.pipe( gulp.dest('.tmp') );
});
// Add vendor prefixes to our generated CSS file.
gulp.task('autoprefixer', function() {
gulp
.src('.tmp/**/*.css')
.pipe( tasks.autoprefixer( 'last 2 versions', 'ie 8' ) )
.pipe( gulp.dest('.') )
.pipe( tasks.livereload(server) )
.pipe( tasks.filesize() );
});
And then in the livereload
server task:
gulp.watch('assets/scss/**', function(e) { gulp.run('compass'); });
gulp.watch('.tmp/**/*.css', function(e) { gulp.run('autoprefixer'); });
from gulp-compass.
The code for this module is confusing... The file object is never actually being manipulated - it runs compass on the file contents but doesn't use the output at all. Very strange.
from gulp-compass.
If this is writing to a tmp folder and not modifying the files in the stream its violating the plugin guidelines
from gulp-compass.
Hi @jannisg,
Please update to version 1.0.2 and try it again.
Thanks.
from gulp-compass.
@appleboy Is there any way to prevent this from writing to disk? Plugins should not be writing this to disk - they should only be modifying the contents in memory and passing them along. The actual disk write happens in gulp.dest
from gulp-compass.
@contra I try to find another way to prevent this from writing to disk, but the compass command is not support with displaying CSS result directly.
I will try to find another approach. Thanks.
from gulp-compass.
@appleboy I know it's not your fault nathggns/node-compass#29
from gulp-compass.
@contra I create issue on compass project. ref Compass/compass/issues/1499
from gulp-compass.
This is exactly why I didn't create a gulp task for Compass. Compass is inherently "designed" as an awful (slow) config mess. I predict nothing will be done about this upstream. I created grunt-contrib-compass and still regret it.
from gulp-compass.
@appleboy I'm confused about what the remaining issues are here (apart from the suckiness of compass itself).
Is there a test-case I could use to reproduce the problem?
Of master now the following is wfm (which I think fix the O.P. problem?):
gulp.src('src/**/*.{scss,css}')
.pipe(compass({
style: 'nested',
sass: 'src',
comments: true,
logging: true
}
))
.pipe(map(function(file, cb){
console.warn("This is triggered ->", file.path);
console.warn(file.contents.toString('utf8'));
cb(null, file);
}));
Thanks!
from gulp-compass.
I have got an idea!
Currently the Compass does not provide an option to return the compiled CSS instead of writing it into the file...
The work-around:
- Create a temporary directory (preferably in system's temp directory)
- Force compass to build CSS there
- Read the compiled CSS files into memory
- Delete temporary files
- Pipe files from memory
By the way, can we use compass watch
to increase speed of compilation process (for watch
tasks?
from gulp-compass.
@taai that's what gulp-ruby-sass does.
from gulp-compass.
@sindresorhus Great! I would like that with Compass too. By the way, can you tell me the difference between compass
and sass --compass
? The compass with all features is being used anyway, right? Or just the syntax?
from gulp-compass.
--compass flag enables the compass imports, but none of the conventions and settings.
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.