Skip to content

Instantly share code, notes, and snippets.

@davidhund
Last active August 29, 2015 13:57
Show Gist options
  • Save davidhund/9897649 to your computer and use it in GitHub Desktop.
Save davidhund/9897649 to your computer and use it in GitHub Desktop.
grunt-browserSync runs before grunt-autoprefixer is done…
I have this Grunt issue where browserSync injects a changes stylesheet before Autoprefixer is done with it. Basically:
1. `Watch` picks up on a changes `style.scss` and runs the `sass:dist` task
2. `sass:dist` outputs `style.scss` -> `style.min.css`
3. next: the `autoprefixer` task processes `style.min.css`
4. **but** in the mean time `browserSync` picks up on the changes `style.min.css` and injects it
5. only now `autoprefixer` finishes with `style.min.css`…
This means my injected `style.min.css` remains out-of-date (no prefixes)...
````
>> File "httpdocs/src/scss/style.scss" changed.
Running "sass:dist" (sass) task
File httpdocs/static/css/style.min.css created.
Running "autoprefixer:no_dest_multiple" (autoprefixer) task
# THIS IS WHERE I EXPECT AUTOPREFIXER TO FINISH… #
[BS] File Changed: style.min.css
[BS] Injecting file into all connected browsers...
# .. BUT IT ONLY SEEMS TO BE DONE HERE... #
File httpdocs/static/css/style.min.css created.
````
Any ideas on how to fix this?
- Should I use a different Grunt configuration?
- "just use Gulp™"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment