Skip to content

Commit 762eba5

Browse files
Fix style issues, and update readme since we have a build process in Github now.
1 parent 199a170 commit 762eba5

File tree

2 files changed

+34
-25
lines changed

2 files changed

+34
-25
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ Right-to-left languages also require the right-to-left version of the stylesheet
7575
`https://www.gstatic.com/firebasejs/ui/2.2.1/firebase-ui-auth-rtl.css`, instead of the default
7676
stylesheet. The supported right-to-left languages are Arabic (ar), Farsi (fa), and Hebrew (iw).
7777

78-
Internationalized binaries are currently not available in the GitHub repository due to dependencies
79-
on translation infrastructure that are not compatible with open sourced tools.
80-
8178
### Option 2: npm Module
8279

8380
Install FirebaseUI and its dependencies via npm using the following command:

gulpfile.js

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ function buildFirebaseUiJs(locale) {
180180
], getTmpJsPath(locale), flags);
181181
}
182182

183-
// Builds the core FirebaseUI JS.
183+
// Builds the core FirebaseUI JS. Generates the gulp tasks
184+
// build-firebaseui-js-de, build-firebaseui-js-fr, etc.
184185
repeatTaskForAllLocales('build-firebaseui-js-$', ['build-soy'],
185186
buildFirebaseUiJs);
186187

@@ -194,6 +195,31 @@ const JS_DEPS = [
194195
'node_modules/dialog-polyfill/dialog-polyfill.js'
195196
];
196197

198+
/**
199+
* Concatenates the core FirebaseUI JS with its external dependencies, and
200+
* cleans up comments and whitespace in the dependencies.
201+
* @param {string} locale The desired FirebaseUI locale.
202+
* @param {string} outBaseName The prefix of the output file name.
203+
* @param {string} outputWrapper A wrapper with which to wrap the output JS.
204+
* @return {*} A stream that ends when compilation finishes.
205+
*/
206+
function concatWithDeps(locale, outBaseName, outputWrapper) {
207+
const localeForFileName = getLocaleForFileName(locale);
208+
// Get a list of the FirebaseUI JS and its dependencies.
209+
const srcs = JS_DEPS.concat([getTmpJsPath(locale)]);
210+
const outputPath = `${DEST_DIR}/${outBaseName}__${localeForFileName}.js`;
211+
return compile(srcs, outputPath, {
212+
compilation_level: 'WHITESPACE_ONLY',
213+
output_wrapper: outputWrapper
214+
});
215+
}
216+
217+
// Bundles the FirebaseUI JS with its dependencies for all locales.
218+
// Generates the gulp tasks build-js-de, build-js-fr, etc.
219+
const buildJsTasks = repeatTaskForAllLocales(
220+
'build-js-$', ['build-firebaseui-js-$'],
221+
(locale) => concatWithDeps(locale, 'firebaseui', OUTPUT_WRAPPER));
222+
197223
/**
198224
* Creates the default FirebaseUI binaries for basic usage without
199225
* localization. For example, it copies firebaseui__en.js to firebaseui.js.
@@ -207,31 +233,15 @@ function makeDefaultFile(fileName) {
207233
}
208234
}
209235

210-
// Bundles the FirebaseUI JS with its dependencies for all locales.
211-
// Generates the gulp tasks build-js-de, build-js-fr, etc.
212-
const buildJsTasks = repeatTaskForAllLocales('build-js-$',
213-
['build-firebaseui-js-$'], (locale) => {
214-
const localeForFileName = getLocaleForFileName(locale);
215-
return compile(
216-
JS_DEPS.concat([getTmpJsPath(locale)]),
217-
`${DEST_DIR}/firebaseui__${localeForFileName}.js`, {
218-
compilation_level: 'WHITESPACE_ONLY',
219-
output_wrapper: OUTPUT_WRAPPER
220-
});
221-
});
222236
gulp.task('build-all-js', buildJsTasks, () => makeDefaultFile('firebaseui'));
223237
gulp.task('build-js', ['build-js-' + DEFAULT_LOCALE],
224238
() => makeDefaultFile('firebaseui'));
225239

226240
// Bundles the FirebaseUI JS with its dependencies as a NPM module.
227-
repeatTaskForAllLocales('build-npm-$', ['build-firebaseui-js-$'], (locale) => {
228-
const localeForFileName = getLocaleForFileName(locale);
229-
const srcs = JS_DEPS.concat([getTmpJsPath(locale)]);
230-
return compile(srcs, `dist/npm__${localeForFileName}.js`, {
231-
compilation_level: 'WHITESPACE_ONLY',
232-
output_wrapper: NPM_MODULE_WRAPPER
233-
});
234-
});
241+
repeatTaskForAllLocales(
242+
'build-npm-$', ['build-firebaseui-js-$'],
243+
(locale) => concatWithDeps(locale, 'npm', NPM_MODULE_WRAPPER));
244+
235245
gulp.task('build-npm', ['build-npm-' + DEFAULT_LOCALE],
236246
() => makeDefaultFile('npm'));
237247

@@ -246,6 +256,8 @@ function buildCss(isRtl) {
246256
const dialogPolyfillSrcs = gulp.src(
247257
'node_modules/dialog-polyfill/dialog-polyfill.css');
248258
let firebaseSrcs = gulp.src('stylesheet/*.css');
259+
260+
// Flip left/right, ltr/rtl for RTL languages.
249261
if (isRtl) {
250262
firebaseSrcs = firebaseSrcs.pipe(flip.gulp());
251263
}
@@ -255,7 +267,7 @@ function buildCss(isRtl) {
255267
mdlSrcs, dialogPolyfillSrcs, firebaseSrcs)
256268
.pipe(concatCSS(outFile))
257269
.pipe(cleanCSS())
258-
.pipe(gulp.dest('dist'));
270+
.pipe(gulp.dest(DEST_DIR));
259271
}
260272

261273
// Concatenates and minifies the CSS sources.

0 commit comments

Comments
 (0)