I have the following setup: A folder named src with all my sass, images, template etc. organized in subdirectories. I use grunt-contrib-copy
, grunt-watch
and grunt-newer
to “compile” this into a valid Shopify theme structure. Grunt-newer
is used to only copy changed files. Let’s say I edit and save my theme.liquid in my src folder, I get the following response:
![screen shot 2013-09-21 at 14 21 10](https://camo.githubusercontent.com/abcdc5674c68086a9601a6691a2ebf44e606bd0e626cba2464c148315e104aa6/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f323330323235342f313138353631302f39363437396361322d323262382d313165332d393437632d6466333461626136636436382e706e67)
It looks like the grunt-shopify run twice. I tried to debug, but with no luck.
I tried to add a delay to grunt-shopify
, but the same thing happens.
I guess grunt-shopify
watch and looks for changes, and react immediately, before the file is done being copied with grunt-contrib-copy
. I tried setting different options in watch like options.spawn
and options.debounceDelay
, but with no luck.
Both grunt-shopify
and grunt-contrib-copy
looks for changes in the app folder, but is it possible to somehow control the order in which they run?
My current watch setup:
watch: {
copy: {
files: '<%= project.src %>/**',
tasks: ['newer:copy:shopify']
},
shopify: {
files: ["app/**"],
tasks: ["shopify"]
}
}
Could it be that grunt-contrib-copy
touches the files twice, and thereby trigger shopify-grunt
twice?
In the end the file get’s uploaded and everything works fine, but the error really annoy me. And I can’t figure out why this happens.