Reputation: 20554
I have an express app with my dev views in /assets/views
. I figure I need to separate development and production views because in production I'll be editing the HTML when I used grunt-contrib-usemin to concat/uglify scripts.
So here's the problem. My current tree:
assets/views
├── 404.html
├── index.html
├── layout.html
├── question_ask.html
└── question_display.html
Ideally, I want my production-ready views to live on the same level as assets. Using grunt-contrib-copy, it seems to copy the whole tree. I currently am putting it into public
since I'm not sure how to set my dest to the root of the project.
copy: {
views: {
src: ['assets/views/*.html'],
dest: 'public/'
}
So there are a few questions here:
Is it bad practice to have dev views and production views? If so, is there another way of producing a view that has references to concat/uglified scripts?
How the heck can I use grunt-contrib-copy to copy to the root of my project? I don't want assets/views
obviously, I just want a views/*
folder that has the contents of what's in assets/views/*
.
Thanks!
Upvotes: 1
Views: 2041
Reputation: 10146
You need to specify the flatten
option which will remove the directory structure from the destination path. See my answer here: Copy all files from directory to another with Grunt.js copy
Upvotes: 3