Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process only new/changed files #57

Closed
macbookandrew opened this issue Oct 26, 2015 · 15 comments
Closed

Process only new/changed files #57

macbookandrew opened this issue Oct 26, 2015 · 15 comments

Comments

@macbookandrew
Copy link

Is it possible to run the tasks only on new/modified files? I currently have 10 emails in my src/emails folder, and it takes ~30 seconds to run all the tasks on every file.

I toyed around with http://grunt-tasks.com/grunt-newer/ and prepending newer: to the default tasks in aliases.yml, but it didn’t seem to make any difference.

Any ideas?

Thanks for the workflow!

@leemunroe
Copy link
Owner

👍

Makes sense. I'll definitely look into it.

macbookandrew added a commit to macbookandrew/grunt-email-workflow that referenced this issue Nov 4, 2015
@macbookandrew
Copy link
Author

@leemunroe I found grunt-newer-explicit and it seems to be working better. Here’s a PR with changes that should work…I’ve modified a bunch of other settings in my working repo, but I think this is enough to get this working.

Also note that I removed clean from the default grunt task…seems at odds with the grunt-newer approach, but it’s up to you.

@macbookandrew
Copy link
Author

macbookandrew commented Nov 4, 2015

The more I think about this, it’s not going to work well.

First run

  1. Save a *.hbs file
  2. The template is assembled
  3. The output is juiced
    So far, so good

Subsequent runs

  1. Make some more changes
  2. The templates are all assembled again because juice modified them
  3. The output files are all juiced again because they’ve been reassembled

Without an intermediate location to save assembled output before juice-ing it to the final location, I’m not sure how to make this work. Any ideas?

@leemunroe
Copy link
Owner

@macbookandrew Did you ever find a good solution for this?

@macbookandrew
Copy link
Author

@leemunroe Not really; I ended up modifying the grunt/juice.js file with a wildcard src and just updating it as necessary for newer files:

    files: [{
      expand: true,
      src: ['<%= paths.dist %>/*2016-08*.html'],
      dest: ''
    }]

@taeo
Copy link
Collaborator

taeo commented May 12, 2017

This is definitely a complicated. I think there's some refactoring/options to watch that can make this better and faster.

  • scss changes should trigger scss, assemble, juice, and replace tasks for all templates.
  • layouts, partials, and data changes should trigger assemble, juice, and replace tasks for all templates.
  • img changes should trigger only imagemin task

Taking it a step further, it's possible to incorporate something like the following that would process only a subset of src/emails/ templates.

grunt watch:specific --files="filename_or_pattern"

grunt build:specific --files="filename_or_pattern"

@macbookandrew
Copy link
Author

@taeo I like the idea. Unfortunately I’m not fluent enough with gulp to build those changes without taking a whole day to do it 😄

@taeo
Copy link
Collaborator

taeo commented May 12, 2017

No worries. I'll give this a spin when I have a second. I'm currently trying to wrap up #87 if you have any opinions or desire to help test that out.

@taeo
Copy link
Collaborator

taeo commented May 17, 2017

Hey @macbookandrew

I just pushed up a fork on my branch for build times and options. It addresses build times as well as watch related options.

It's not "automagic" unfortunately, but here's a use case that would only watch for and process:

  • template updates matching the name *2016-08*.
  • scss updates get compiled, but only applied to the afore mentioned templates
  • (Any layouts, data, or partials trigger a complete rebuild of all templates)
grunt preview --template="*2016-08*"

Additional grunt option --noinline can be passed if you don't want css styles inlined (will be preserved in <style> tag.

grunt preview --template="*2016-08*" --noinline

Let me know if you're willing to give the branch a spin and provide any thoughts, feedback, or questions.

@leemunroe
Copy link
Owner

@taeo Sweet. Give it a good test and works a treat! 🎉

@taeo
Copy link
Collaborator

taeo commented May 19, 2017

Solid. Thanks for testing!

There's a little tidying up and README updates to make. Other than that, should we give it a little time and prompt a few more people to test, or just go PR and done?

@leemunroe
Copy link
Owner

Maybe give it a few more days in case @macbookandrew has time to try it out. Curious if it solves his problem. But it LGTM to PR.

@macbookandrew
Copy link
Author

@leemunroe @taeo Thanks! I just got back from vacation. Hopefully I can test this out in the next few days, but don’t hold it just on my account.

@taeo
Copy link
Collaborator

taeo commented May 22, 2017

@macbookandrew - welcome back! Hope you had a good vacay. No rush here. Would love to have input + further testing to see if it meets your needs and is easy enough to use this way.

@taeo
Copy link
Collaborator

taeo commented Jun 28, 2018

Closing based on forthcoming PR from feature/build-times-and-options

@taeo taeo closed this as completed Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants