dogancelik / gulp-pug-i18n Goto Github PK
View Code? Open in Web Editor NEWi18n support for gulp-pug plugin
License: MIT License
i18n support for gulp-pug plugin
License: MIT License
I want to keep the locales in the relative path to the template file. Is there any way to do it?
// gulpfile.js
const gulp = require('gulp');
const gulpPugI18n = require('gulp-pug-i18n');
const gulpPugI18nOpts = {
i18n: { locales: 'locales/*.json' }
};
const buildViews = () => {
return gulp.src('views/*.pug')
.pipe(gulpPugI18n(gulpPugI18nOpts))
.pipe(gulp.dest('dist'));
};
const watchViews = () => {
gulp.watch('views/*.pug', buildViews);
});
const watch = gulp.series(buildViews, watchViews);
module.exports = { watch };
$ gulp watch
[...]
# After modifying a pug file
Error in plugin "gulp-plugin-i18n"
Message:
Object must have "i18n" object
Details:
domain: [object Object]
domainThrown: true
After taking a look at the code, the options
object passed to the gulpPugI18n
function is mutated by deleting the i18n
member here.
Add a call to Object.assign
to create a new object: options = Object.assign({}, options);
.
I want to use this in a pug file:
p - #{Object.keys(locals)} -
p - #{lang} -
p - #{basename} -
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.