claudetech / node-static-i18n

HTML static pages i18n tool
https://www.npmjs.com/package/static-i18n
MIT License
102 stars 21 forks source link

Run command on Gulp? #18

Open alvarotrigo opened 6 years ago

alvarotrigo commented 6 years ago

Is there a way to run the command on gulp without using the gulp plugin? I had a few issues with the plugin and it seems not to be using the global static-i18n module anyways.

I tried the gulp-shell module but I never managed to run my script, not quite sure why:

static-i18n -l en -i en -i es --fileFormat yml --allowHtml --i18n "{\"keyseparator\": \"::\"}" www
danhper commented 6 years ago

Hi! To be honest, the projects where I use this module are still using Grunt, with the plugin I wrote https://github.com/claudetech/grunt-i18n-static It should probably work with gulp, and I am aware someone wrote a plugin for it, but I never tried it. Both the gulp and grunt plugin should change static-i18n to a peer dependency to avoid staying blocked to an older version. I think using the plugin would be a better solution than using gulp-shell, although I am not sure why gulp-shell would not work. I will give it a try if I have a moment, but please let me know if you find a solution. Thank you.

alvarotrigo commented 6 years ago

Both the gulp and grunt plugin should change static-i18n to a peer dependency to avoid staying blocked to an older version

Yeah I think that's the issue.

alvarotrigo commented 6 years ago

In any case, I manage to run the script using gulp-shell by playing a bit with the quotes here and there:

gulp.task('shell', shell.task([
  "static-i18n -l en -i en -i es --fileFormat yml --allowHtml true www"
]));

But... for some reason, it seems to create different results than when executing exactly the same command on the terminal (or running it from a .sh file).

#!/bin/bash
static-i18n -l en -i en -i es --fileFormat yml --allowHtml true www

It seems as if gulp-shell is also using an older version of node-static-i18n totally ignoring the latest changes. Same as gulp-static-i18n-html.

<p>
    texto aqui
    Whatever here
</p>

Instead of the following, created when running the exact same command on the console:

<p data-t-interpolate="">
    texto aqui
    <div>Whatever here</div>
</p>

when using the following original file:

<p data-t data-t-interpolate>
    {{text here}}
    <div>Whatever here</div>
</p>