Closed mpodciwinski closed 5 years ago
The first issue I see is that you'll always get test.hbs
files as output. You'll want to use something like gulp-rename
to get what you're hoping for from .pipe(gulp.dest('./dist/' + locale))
.
The second issue is that it would appear locale
is undefined, which is why you're getting an undefined directory in your output. I recommend using the hb({ debug: true })
flag to make sure your data is registered as you expect.
it receives:
test.hbs
global data:
i18n locale
local data:
decorators:
inline
helpers:
blockHelperMissing helperMissing log unless
each if lookup with
partials:
head
are you able to correct my gulp configurations?
I wish I had the time, but the best I can do at the moment is point you to other issues where this exact pattern is addressed.
https://github.com/shannonmoeller/gulp-hb/issues/51
You’re super close. You just need gulp-rename
and to update your template to use {{ i18n.title }}
instead of {{ title }}
, etc.
Good luck!
Looks like my past self has you covered:
it works now, thanks a lot!
Is it possible to save the resulting files in separate folders?
example:
Data .json
files:
├── Data
│ ├── en
│ │ ├── index.json
│ │ ├── products.json
│ ├── de
│ │ ├── index.json
│ │ ├── products.json
Html output:
├── Dist
│ ├── en
│ │ ├── index.html
│ │ ├── products.html
│ ├── de
│ │ ├── index.html
│ │ ├── products.hrml
Awesome! So glad to hear it.
You totally can. gulp-rename
accepts a dirname
property you can use for that:
.pipe(rename({
dirname: "main/text/ciao",
basename: "aloha",
prefix: "bonjour-",
suffix: "-hola",
extname: ".md"
}))
Hello, trying to use the i18n module to write files in individual languages using .json files.
Unfortunately, I can not do it. Partial works, but json data not.
This is my gulp settings:
sample json files:
test.hbs
my tree:
and this is what I receive: tree:
dist/undefinded/test.hbs
What I'm doing wrong? please help