Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Gulp Basics Compile Sass with Gulp Turn Sass into CSS, automatically

gulp sass vs sass --watch

How is this different from using sass command --watch flag? I still have to open terminal and type gulp compileSass. Maybe its 2-3 seconds faster because I know I don't have to type the src and dest files (ie app.scss:app.css), but what is a real benefit of this?

2 Answers

Colin Marshall
Colin Marshall
32,861 Points

One of the benefits is that you can combine it with other build tasks. So you can create one watch task that triggers different tasks depending on where the file is located and what the file's extension is. Normally with gulp you would be running more than just a Sass task when developing. You would also be concatenating javascript files, converting coffeescript, etc.

Another benefit is that you can customize the Sass task to add browser prefixes, check for errors, reload the browser window on file changes, etc. You can make it do whatever you want.

You will discover more benefits as this course progresses.

Seth Kroger
Seth Kroger
56,414 Points

Gulp has it's own watch task you'll get to later in the course. You can combine it with the other tasks to watch for changes in all the files, not just the sass.