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

Generating markup exits grunt-contrib-watch task #12

Open
pentzzsolt opened this issue Jul 10, 2014 · 3 comments
Open

Generating markup exits grunt-contrib-watch task #12

pentzzsolt opened this issue Jul 10, 2014 · 3 comments

Comments

@pentzzsolt
Copy link

I have the following issue:

I use several grunt plugins during development, concat, uglify, spritesmith, sass, liquid, connect and watch. My watchers are set up in a nice way to run the exact tasks I need at any time.

When I have only one .liquid file to parse, with whatever amount of includes, my watch task sees that there has been modification in the markup folder and runs the liquid task, browser refreshes, all fine.

But! When I have multiple .liquid files to create multiple .html files from, the watch task runs the liquid task, generates the correct files, but then my grunt watch task exits and the node.js command prompt waits for a command.

Let me know if you need anything at all from me, details, configuration files, I enjoy this plugin very much and would like to help you find this bug.

@saddam-azad
Copy link

I have faced this problem.

The liquid task within your Gruntfile's 'watch' needs to have spawn enabled. Cons: It will make .liquid compilation quite slow. My environment takes 20-25 seconds on average.

However, you can use grunt-newer to only compile the changed .liquid template and ignore the rest. This brings the compilation time down to 14-15 seconds.

I wish I didn't have to use spawn - because the compile time is <1s without it. But it's the only way to make it work right now.

watch: {
    liquidTemplate: {
        options: {
            spawn: true,
        },
        files: "views/**/*.liquid",
        tasks: ['newer:liquid']
    }
} // end watch

@KenVanGilbergen
Copy link

I was also having this problem. Basically whenever I ran the liquid task before the watch task it exited to the console. In the end I used grunt-concurrent to bundle my liquid and sass tasks and put the watch after. This works fine.

...
watch: {
liquid: {
files: ['src/*/.liquid'],
tasks: ['newer:liquid'],
},
...
concurrent: { rebuild: ['liquid', 'sass', 'uglify'] }
...
grunt.registerTask('dev', ['express', 'open', 'watch']);
grunt.registerTask('default', ['concurrent:rebuild', 'dev']);

@randohinn
Copy link

I'm facing the same issue, with spawn enabled. See #21

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

No branches or pull requests

5 participants