Comments (3)
@AdrienGiboire The problem here is you are trying to define dev
and dist
targets under the process-html-template
target. You can't nest targets within targets =)
From copying the README examples, you need to replace process-html-template
with dev
, and then duplicate and replace dev
with dist
, like so:
// README example
grunt.initConfig({
template: {
options: {
// Options for all targets go here
},
yourTarget: {
options: {
// Target-specific options go here
},
files: {
// Target-specific file lists go here
}
}
}
});
// Adding your dev and dist targets.
grunt.initConfig({
template: {
options: {
data: {
'current_locale': 'en-us',
'css_file': 'css/main.css'
}
},
dev: {
files: {
'<%= yeoman.dev %>/index.html': ['<%= yeoman.app %>/index.html']
}
},
dist: {
files: {
'<%= yeoman.dist %>/index.html': ['<%= yeoman.dist %>/index.html']
}
}
}
Now call grunt template:dev
and grunt template:dist
, or just grunt template
to run all the targets.
from grunt-template.
This is what I ended doing but I found this less flexible and neat.
Thanks for the reply :)
from grunt-template.
Is it that you want options per target? You can do that:
template: {
options: {
data: {
'current_locale': 'en-us',
'css_file': 'css/main.css'
}
},
dev: {
options: {
data: {
'name': 'dev'
}
},
files: {
'dev/index.html': ['app/index.html']
}
},
dist: {
options: {
data: {
'name': 'dist'
}
},
files: {
'dist/index.html': ['build/index.html']
}
}
}
from grunt-template.
Related Issues (9)
- No error when template can't be found HOT 2
- custom delimiters not working on js files? HOT 9
- permit named named variable option
- [Question] Target all files in a directory HOT 1
- Task vs. Target specific options [doesn't work] HOT 4
- How to create multiple templates at once?
- Specify destination file permissions
- No ability to do easy glob wildcards of files HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-template.