Individual output folders
montlebalm opened this issue · 4 comments
Here's my grunt config:
react: {
options: {
extension: 'jsx',
ignoreMTime: false
},
apps: {
files: {
'public/apps/': ['public/apps/']
}
}
}
This would take public/apps/foo/bar.jsx
and turn it into public/apps/foo/bar.js
. Is there a way I could instead move it into something like public/apps/foo/build/bar.js
? I'd like to be able to ignore the built files from jshint, since they fail with my current project's rules.
I don't have a central location where all my React files live, and I'd rather not put grunt rules for ever folder that does (could be dozens).
Ah, the problem here is the same problem you'd have with any grunt task: you want the output path to be entirely different from the source path.
If you wanted to do something like public/build/apps/foo/bar.js
, which I & most other projects do, you'd have no problem. But the fact that you want to turn apps/foo/bar.js
into apps/foo/build/bar.js
, you've basically created the problem and the need to manually hand-point each source file to a specific destination.
My recommendation is to keep your build
folder completely separate from your source files, otherwise you'll end up writing crazy rules in grunt to ignore the build .JS, but process everything else.
This will actually be possible with pull request #13 using dynamic mappings (http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically).
react: {
files: [
{
expand: true,
cwd: 'public/apps',
src: ['**/*.jsx'],
dest: '.',
ext: '.js'
}
]
}
Good point! Looks like I need to merge that PR ASAP!
Resolved via #13 on master
.