Closed terkelg closed 7 years ago
Is there any other watchers or grunt files running? At the watcher stage there shouldn't be anything involved with the plugin (i.e grunt-contrib-watch is being on the app folder so should never touch the src
folder) from that setup
It's the only watch and Gruntfile running. But if you look at the terminal screenshot, you can see that the first upload is from the src folder and the second is from the app folder. Everything runs smoothly if I remove the grunt-contrib-copy from the Gruntfile.
I'm seeing the same issue as well. I'm working out of a shop
folder and then using ryanburnette/grunt-shopify-theme to copy over the necessary files to a dist
folder. According to my terminal output grunt-shopify
uploads the changed file from shop
first then after grunt-shopify-theme
runs grunt-shopify
again uploads the changed file from dist
.
Since grunt-shopify-theme also uses grunt-contrib-copy I tested disabling that task and when I did only one upload happened on change. So maybe some sort of conflict with grunt-contrib-copy triggers the first erroneous upload?
@farneman exactly! grunt-shopify trigger before other tasks defined in watch.
Same issue here. Overall it works well and files get uploaded, just 5% weird that its trying to upload initially on a file save from a directory not specified in the files array, seemingly out of turn. Don't have a solution and this won't stop my enjoyment of the plugin, but any insight would be much appreciated :) All plays well when not combined with another task that uses watch, in this case grunt-contrib-sass. Here's a screengrab and my watch for good measure:
watch: {
css: {
files: ['_sass/**/*.scss'],
tasks: ['sass','cssc'],
options: {
spawn: false,
}
},
shopify: {
files: ['theme/assets/**','theme/config/**','theme/layout/**','theme/snippets/**','theme/templates/**'],
tasks: ["shopify"]
}
}
Edit: https://github.com/erickreutz/grunt-shopify this version fixes the multiple upload issue for me. Sorry if I jumped the gun, new to this plugin. Thanks so much all for the great work. Cheers!
I believe the issue is that the watch event doesn't respect which target. now v0.5 of watch does include the target as an arg so we may be use that but my latest changes should also prevent from uploading anything not in base path (which is cwd if not using a base)
I think this is the commit that fixes it: https://github.com/erickreutz/grunt-shopify/commit/39c29e81b6209ba3fe78ab0b92270270453a366d?w=1
I'm getting a similar bug.
It's great that it's letting me know that that file isn't allowed, but it shouldn't really be checking outside of the folders I declare for it to watch anyways.
watch:
styles:
files: ["styles/*"]
tasks: ["concat"]
shopify:
files: ["assets/*","config/*","layout/*","snippets/*","templates/*"]
tasks: ["shopify"]
Agreed with Gray above. No need to watch/notify me of files outside those declared in files
.
Should now be resolved.
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
andgrunt-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: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 withgrunt-contrib-copy
. I tried setting different options in watch likeoptions.spawn
andoptions.debounceDelay
, but with no luck.Both
grunt-shopify
andgrunt-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:
Could it be that
grunt-contrib-copy
touches the files twice, and thereby triggershopify-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.