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

Gulp source adapter, release 1.0 #137

Merged
merged 23 commits into from
Mar 20, 2015
Merged

Gulp source adapter, release 1.0 #137

merged 23 commits into from
Mar 20, 2015

Conversation

robwierzbowski
Copy link
Contributor

1.0 will implement the plugin as a vinyl stream source, similar to a vinyl adapter, but only implementing the src part, and using gulp.watch and gulp.dest for the rest.

Interface:

gulp.task('styles', function () {
  return rubySass(
    // This replaces `update` or `file:file` as the source. 
    // The appropriate Sass command is fired 
    // based on whether a file or directory is passed.
    'app/styles', {
        sourcemap: true,
        style: 'expanded',
        precision: 10
    })
    .pipe($.autoprefixer(['last 2 versions']))
    .pipe(gulp.dest('.tmp/styles'))
    .pipe($.size({title: 'styles'}));
});

Because it's basically spawn that pipes into a gulp stream I think the only things we'd have to touch in the output would be sourcemaps (of course) and maybe error handling.

We would lose the ability to add the plugin at any point in the pipe. But aside from linting, which could be a separate task, I've seen no common reason to transform the Sass files before compiling them to CSS. The maintenance / allowing 90% of users to use Sass like they would on the cli or with Grunt outweighs supporting those edge cases.

  • Implement as vinyl stream source with update
  • Decide on error handling, re-implement logging
  • Add gulp-sourcemap support for inline and none
  • Implement as vinyl stream source with update directory compilation
  • Add single file compilation
  • Add gulp-sourcemap support for file
  • Add gulp-sourcemap tests
  • Add gulp-sourcemap recipes
  • Allow parallel calls to the plugin without jumble of CSS files Instead of making this automatic I expanded documentation of the container option, added a recipe.
  • Update readme with changes

Feature level releases after 1.0 (or if I have time during the alpha)

  • Support file globbing
  • Add smart src property that delegates between dirs, files, and file globs
  • Document a working incremental build recipe

@sindresorhus
Copy link
Owner

Nice!

We would lose the ability to add the plugin at any point in the pipe.

Should be mentioned in the readme ;)

@robwierzbowski
Copy link
Contributor Author

For sure. I'll tidy up the readme last, to get everything that changes.

On Sunday, September 28, 2014, Sindre Sorhus notifications@github.com
wrote:

Nice!

We would lose the ability to add the plugin at any point in the pipe.

Should be mentioned in the readme ;)


Reply to this email directly or view it on GitHub
#137 (comment)
.

Rob Wierzbowski
@robwierzbowski http://twitter.com/#!/robwierzbowski
http://github.com/robwierzbowski
http://robwierzbowski.com

@UltCombo
Copy link
Contributor

We would lose the ability to add the plugin at any point in the pipe. But aside from linting, which could be a separate task, I've seen no common reason to transform the Sass files before compiling them to CSS.

I just found an issue with that, namely incremental builds with gulp-watch. E.g., this is a (IMO) common use case that would no longer work:

gulp.task('default', function() {
    var srcGlob = 'scss/*.scss';
    return gulp.src(srcGlob)
        .pipe(watch(srcGlob, function(files) {
            return files
                .pipe(sass())
                .pipe(gulp.dest('css'));
    }));
});

@robwierzbowski
Copy link
Contributor Author

Good point. For simple tasks if we get sass-cache working we'd be ok. There are a bunch of gulp incremental filtering tasks — I wonder if one will work with this style plugin.

The adapter approach solves so many problems I think even with only a partial support case it's worth it.

@robwierzbowski
Copy link
Contributor Author

Added @sindresorhus's readme note and @UltCombo's incremental build note to the issue tasks.

@ybian
Copy link

ybian commented Oct 19, 2014

Waiting for this...

@robwierzbowski
Copy link
Contributor Author

Sourcemaps working for inline. Next in priority is file, then allowing compilation of a single file, then documenting or implementing an incremental/cached build. After that I'll roll an aplha and start pinging people to test it while I work on other features.

@UltCombo
Copy link
Contributor

Yay nice work @robwierzbowski! 😄

@robwierzbowski
Copy link
Contributor Author

Re: sourcemap integration, here's a related Sass issue.

sass/sass#1485

The answer to this will change how we deal with sourcemaps.

Rob Wierzbowski added 19 commits March 20, 2015 14:23
Temporarily adding this for easier work with logs and errors. This is the
keystone of the caching issue that has to be resolved.
This makes sourcemaps option a bool in order to provide consistent integration
with gulp- sourcemaps. If people complain we can allow sass option strings to
pass through and do gulp style when the option is passed a bool.
I've been using these, probably good to make available to everyone else.
Directions on use in the html file.
- Update for new sourcemaps
- Update for sourcemap adapter
- Add recipe for running two sass tasks at the same time

	I explored adding smart container switching to the plugin but I think it will
	interfere with any type of incremental build / caching that we add. Specifying
	an option isn't a hard request to make to our users either.
Also add a note that these options are incomplete.
If there are spaces or special characters in the path or file name the two paths
won't match up and cancel out when we pass them to path.relative. Ensures both
paths are in a decoded state. Adds tests as well.
…st above

I added this initally thinking that we might have images in the compiled folder.
We may once we get to compass support but for now removing because untill we
need it, YAGNI.
Logging as a gulp command line argument has been given the nay-no:
gulpjs/gulp#107. The maintainers of gulp say gulpfiles
are node applications, and options should be managed in code.

We will let people get some extra output with the verbose optiion.
Copied from `sass -h`, version 3.4.8
@robwierzbowski
Copy link
Contributor Author

OK, that's it. Ready to make 1.0 real and go from there.

robwierzbowski pushed a commit that referenced this pull request Mar 20, 2015
Gulp source adapter, release 1.0
@robwierzbowski robwierzbowski merged commit f7234e1 into master Mar 20, 2015
@robwierzbowski robwierzbowski deleted the rw/1.0 branch March 20, 2015 18:34
@robwierzbowski
Copy link
Contributor Author

Published 1.0.0. OK, now to take care of these: https://github.com/sindresorhus/gulp-ruby-sass#important

@sindresorhus
Copy link
Owner

Woot! Awesome work @robwierzbowski :)

5fa79994-b5ee-11e3-9a4d-b19557d7480b

@jmcbee
Copy link

jmcbee commented Apr 19, 2015

ahaha

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

Successfully merging this pull request may close these issues.

8 participants