Need a way to flatten the output of "with-plugin"
LaurentGoderre opened this issue · 15 comments
Right now, it preserves the structure of the templates which is not necessarily the desired behavior.
Any idea how we would tackle that?
I used assemble-contrib-permalinks for it, works nicely on 2 projects already.
have you tried the files array format? if that doesn't work, the permalinks plugin would be my suggestion as well. I don't think this complexity belongs in the i18n plugin
Files array shouldn't work because it's a custom array
It is flattened, isn't it?
No, it preserves the path of the template
Good point, I forgot about that
Sent from my iPhone
On Mar 4, 2014, at 9:48 AM, Laurent Goderre notifications@github.com wrote:
Files array shouldn't work because it's a custom array
—
Reply to this email directly or view it on GitHub.
BTW, permalinks does not solve this issue. It adds the path to the template before the permalink
permalinks does not solve this issue. It adds the path to the template before the permalink
It does though, because the dest can be anything you want it to be:
assemble: {
foo: {
options: {
permalinks: {
structure: 'dist/:foo/:bar/:index:ext'
}
},
files: {
'./': ['templates/*.hbs']
}
}
}
meaning that if the dest
is "nothing", then permalinks constructs the entire dest path.
This is what I have:
assemble:{
theme: {
options: {
plugins: ['assemble-contrib-i18n'],
i18n: {
languages: ["en", "fr"],
templates: ['site/pages/theme/*.hbs']
}
},
dest: "dist/unmin/theme/",
src: "!*.*"
}
}
The output of this is dist/unmin/theme/site/pages/theme/index-en.html
It should be something like:
assemble:{
theme: {
options: {
plugins: ['assemble-contrib-i18n', 'assemble-contrib-permalinks'],
i18n: {
languages: ["en", "fr"],
templates: ['site/pages/theme/*.hbs']
},
permalinks: {
structure: 'dist/unmin/theme/:whatever/:props/:index:ext'
}
},
files: {'./': ['!*.*']}
}
}
The structure
will build the dest how ever you want it.
the reason the permalinks plugin is advantageous for this kind of situation, is if you had multiple plugins that each attempted to modify the dest somehow you would run into problems quickly. but the permalinks plugin allows you to construct virtually any kind of dest path you can think of, and it will work with other plugins.
This is what I'm confused about... this example in the Gruntfile.js is the same thing... also flatten: true
is in the assemble.options
so that might be the reason that it's working in this example. You can see the results in the test/actual/with-plugin/
folder
You're right...though @jonschlinkert example worked....I'm curious now...
Damn I'm dumb....I forgot the flatten parameter. Sorry about that guys :S
lol no worries. this flexibility is a double-edged sword. I think our new docs will really help! we're working night and day to get them done!