commonplace
Advanced tools
Comparing version 0.5.5 to 0.5.7
@@ -5,3 +5,3 @@ { | ||
"description": "Reusable components for the Firefox Marketplace", | ||
"version": "0.5.5", | ||
"version": "0.5.7", | ||
"ignore": [ | ||
@@ -8,0 +8,0 @@ "bin", |
@@ -11,4 +11,5 @@ (function() { | ||
]; | ||
var body_langs; | ||
if (body_langs = document.body.getAttribute('data-languages')) { | ||
// Resist the temptation to use .dataset, as it doesn't work with IE10. | ||
var body_langs = document.body.getAttribute('data-languages'); | ||
if (body_langs) { | ||
languages = JSON.parse(body_langs); | ||
@@ -40,2 +41,23 @@ } | ||
function get_locale_src(locale, document) { | ||
if (!document) { | ||
document = window.document; | ||
} | ||
// We need the CDN url, but only in a website context - if we are inside a | ||
// packaged app, we don't want an unecessary network request. Fortunately, | ||
// the packaged app's app.html shouldn't have data-media set on its <body>. | ||
var media_url = document.body.getAttribute('data-media'); | ||
// If we have a build id, cool, we'll use that to do cachebusting. If we | ||
// don't, then we're probably in a packaged app context again and don't | ||
// need to care about that. | ||
var build_id = document.body.getAttribute('data-build-id-js'); | ||
var repo = document.body.getAttribute('data-repo'); | ||
return [ | ||
media_url ? media_url : '/media/', | ||
repo ? repo + '/' : '', | ||
'locales/' + locale + '.js', | ||
build_id ? '?b=' + build_id : '' | ||
].join(''); | ||
} | ||
if (!window.define) { | ||
@@ -51,7 +73,4 @@ var qs_lang = /[\?&]lang=([\w\-]+)/i.exec(window.location.search); | ||
// Cachebust the .js file for our CDN. | ||
var build_id = document.body.getAttribute('data-buildIdJs') || +new Date(); | ||
var repo = document.body.getAttribute('data-repo'); | ||
/* jshint ignore:start */ | ||
document.write('<script src="/media/' + (repo ? repo + '/' : '') + 'locales/' + locale + '.js?b=' + build_id + '"></script>'); | ||
document.write('<script src="' + get_locale_src(locale) + '"></script>'); | ||
/* jshint ignore:end */ | ||
@@ -115,2 +134,3 @@ | ||
}, | ||
getLocaleSrc: get_locale_src, | ||
getLocale: get_locale, | ||
@@ -117,0 +137,0 @@ languages: languages |
@@ -51,3 +51,3 @@ define('login', | ||
$this.addClass('loading-submit'); | ||
startLogin().always(function() { | ||
startLogin({register: $this.hasClass('register')}).always(function() { | ||
$this.removeClass('loading-submit').trigger('blur'); | ||
@@ -79,3 +79,3 @@ }); | ||
function startLogin() { | ||
function startLogin(options) { | ||
var w = 320; | ||
@@ -90,5 +90,9 @@ var h = 600; | ||
privacyPolicy: settings.persona_privacy, | ||
register: false, | ||
siteLogo: settings.persona_site_logo, | ||
oncancel: oncancel | ||
}; | ||
// Override our settings with the provided ones. | ||
_.extend(opt, options); | ||
if (settings.persona_unverified_issuer) { | ||
@@ -136,2 +140,5 @@ // We always need to force a specific issuer because bridged IdPs don't work with verified/unverified. | ||
fxa_url = settings.fxa_auth_url; | ||
if (opt.register) { | ||
fxa_url += '&action=signup'; | ||
} | ||
} | ||
@@ -138,0 +145,0 @@ fxa_popup = window.open( |
@@ -5,11 +5,15 @@ /* | ||
*/ | ||
define('site_config', ['defer', 'requests', 'settings', 'urls'], | ||
function(defer, requests, settings, urls) { | ||
define('site_config', ['defer', 'requests', 'settings', 'underscore', 'urls'], | ||
function(defer, requests, settings, _, urls) { | ||
function fetch() { | ||
var def = defer.Deferred(); | ||
requests.get(urls.api.url('site-config')).done(function(data) { | ||
settings.fxa_auth_url = data.fxa.fxa_auth_url; | ||
settings.fxa_auth_state = data.fxa.fxa_auth_state; | ||
settings.switches = data.waffle.switches || []; | ||
requests.get(urls.api.unsigned.url('site-config')).done(function(data) { | ||
if (data.hasOwnProperty('fxa')) { | ||
settings.fxa_auth_url = data.fxa.fxa_auth_url; | ||
settings.fxa_auth_state = data.fxa.fxa_auth_state; | ||
} | ||
if (data.waffle.switches && _.isArray(data.waffle.switches)) { | ||
settings.switches = data.waffle.switches; | ||
} | ||
def.resolve(data); | ||
@@ -16,0 +20,0 @@ }).always(function() { |
@@ -106,3 +106,4 @@ define('urls', | ||
var host = settings.api_url; | ||
if (utils.baseurl(path) in settings.api_cdn_whitelist) { | ||
if (settings.api_cdn_whitelist && | ||
utils.baseurl(path) in settings.api_cdn_whitelist) { | ||
host = settings.cdn_url; | ||
@@ -109,0 +110,0 @@ } |
@@ -17,2 +17,3 @@ var amdOptimize = require('amd-optimize'); | ||
var webserver = require('gulp-webserver'); | ||
var mergeStream = require('merge-stream'); | ||
var requireDir = require('require-dir'); | ||
@@ -24,2 +25,3 @@ var _ = require('underscore'); | ||
var nunjucksBuild = require('./plugins/nunjucks-build'); | ||
var imgurlsAbsolutify = require('./plugins/imgurls-absolutify'); | ||
var imgurlsCachebust = require('./plugins/imgurls-cachebust'); | ||
@@ -64,2 +66,3 @@ var imgurlsParse = require('./plugins/imgurls-parse'); | ||
gulp.task('templates_build', function() { | ||
// Build Nunjucks templates into a templates.js file. | ||
return gulp.src(paths.html) | ||
@@ -84,3 +87,4 @@ .pipe(nunjucksBuild()) | ||
gulp.task('css_compile', function(done) { | ||
gulp.task('css_compile', function() { | ||
// Compile .styl files into .styl.css files. | ||
return gulp.src(paths.styl) | ||
@@ -95,8 +99,43 @@ .pipe(stylus()) | ||
gulp.task('css_build', ['css_compile'], function() { | ||
return gulp.src([paths.css, | ||
'!' + config.CSS_DEST_PATH + paths.include_css]) | ||
gulp.task('css_bundles', ['css_compile'], function() { | ||
// Read the config and build specified CSS bundles (like for splash.css). | ||
var streams = []; | ||
Object.keys(config.cssBundles || []).forEach(function(bundle) { | ||
streams.push(gulp.src(config.CSS_DEST_PATH + config.cssBundles[bundle]) | ||
.pipe(concat(bundle)) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest(config.CSS_DEST_PATH)) | ||
); | ||
}); | ||
// Yes, cross the streams. | ||
if (streams) { | ||
return mergeStream.apply(this, streams); | ||
} | ||
}); | ||
gulp.task('css_build', ['css_bundles', 'css_compile'], function() { | ||
// Bundle and minify all the CSS into include.css. | ||
var excludes = Object.keys(config.cssBundles || []).map(function(bundle) { | ||
// Exclude generated bundles if any specified in the config. | ||
return bundle; | ||
}); | ||
// Exclude previously generated builds. | ||
excludes.push(paths.include_css); | ||
// Exclude from project config. | ||
if (config.cssExcludes) { | ||
excludes = excludes.concat(config.cssExcludes); | ||
} | ||
excludes = excludes.map(function(css) { return '!' + config.CSS_DEST_PATH + css; }); | ||
return gulp.src([paths.css].concat(excludes)) | ||
.pipe(stylus({compress: true})) | ||
.pipe(imgurlsCachebust()) | ||
.pipe(imgurlsAbsolutify()) | ||
.pipe(minifyCSS()) | ||
// Order by base styles first. | ||
.pipe(order(['base/*.styl.css', '*.styl.css'], | ||
{base: config.CSS_DEST_PATH})) | ||
.pipe(concat(paths.include_css)) | ||
@@ -103,0 +142,0 @@ .pipe(gulp.dest(config.CSS_DEST_PATH)); |
@@ -7,3 +7,3 @@ var config = require('../../../../config'); | ||
styl: config.CSS_DEST_PATH + '**/*.styl', | ||
styl_compiled: config.CSS_DEST_PATH + '**/*.css.styl', | ||
styl_compiled: config.CSS_DEST_PATH + '**/*.styl.css', | ||
html: 'src/templates/**/*.html', | ||
@@ -10,0 +10,0 @@ include_css: 'include.css', |
@@ -1,3 +0,1 @@ | ||
var _ = require('underscore'); | ||
var CORE_MODULES = [ | ||
@@ -65,3 +63,3 @@ // Core JS modules. | ||
}; | ||
_.each(CORE_MODULES, function(module) { | ||
CORE_MODULES.forEach(function(module) { | ||
if (CORE_MODULES_ROOT_JS.indexOf(module) !== -1) { | ||
@@ -74,6 +72,6 @@ // Modules that go into the root JS path (for some reason). | ||
}); | ||
_.each(CORE_VIEWS, function(view) { | ||
CORE_VIEWS.forEach(function(view) { | ||
bowerConfig[CORE_SRC_PATH + view + '.js'] = CORE_DEST_PATH + 'views/'; | ||
}); | ||
_.each(BASE_TEMPLATES, function(template) { | ||
BASE_TEMPLATES.forEach(function(template) { | ||
bowerConfig[CORE_TEMPLATE_PATH + template] = 'src/'; | ||
@@ -100,3 +98,3 @@ }); | ||
}; | ||
_.each(CORE_MODULES, function(module) { | ||
CORE_MODULES.forEach(function(module) { | ||
if (CORE_MODULES_ROOT_JS.indexOf(module) !== -1) { | ||
@@ -107,3 +105,3 @@ return; | ||
}); | ||
_.each(CORE_VIEWS, function(view) { | ||
CORE_VIEWS.forEach(function(view) { | ||
requireConfig.paths[view] = 'lib/commonplace/' + view; | ||
@@ -110,0 +108,0 @@ }); |
{ | ||
"name": "commonplace", | ||
"version": "0.5.5", | ||
"description": "Reusable components for Firefox Marketplace frontend projects.", | ||
"version": "0.5.7", | ||
"main": "lib/commonplace", | ||
@@ -15,8 +16,4 @@ "preferGlobal": true, | ||
"dependencies": { | ||
"clean-css": "2.0.x", | ||
"jshint": "2.3.x", | ||
"nunjucks": "1.0.x", | ||
"stylus": "0.32.x", | ||
"uglify-js": "2.4.x", | ||
"underscore": "1.7.x" | ||
"nunjucks": "1.0.x" | ||
}, | ||
@@ -23,0 +20,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
833521
2
311
5807
- Removedclean-css@2.0.x
- Removedstylus@0.32.x
- Removeduglify-js@2.4.x
- Removedunderscore@1.7.x
- Removedamdefine@1.0.1(transitive)
- Removedasync@0.2.10(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedclean-css@2.0.8(transitive)
- Removedcommander@2.0.0(transitive)
- Removedcssom@0.2.5(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedms@2.1.3(transitive)
- Removedsource-map@0.1.34(transitive)
- Removedstylus@0.32.1(transitive)
- Removeduglify-js@2.4.24(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedunderscore@1.7.0(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedyargs@3.5.4(transitive)