addons-server/mkt/asset_bundles.py

385 строки
11 KiB
Python
Исходник Обычный вид История

# A list of our CSS and JS assets for jingo-minify.
CSS = {
'mkt/devreg': (
# Contains reset, clearfix, etc.
'css/devreg/base.css',
# Base styles (body, breadcrumbs, islands, columns).
2013-03-19 07:55:13 +04:00
'css/devreg/base.styl',
'css/devreg/breadcrumbs.styl',
# Typographical styles (font treatments, headings).
2013-03-19 07:55:13 +04:00
'css/devreg/typography.styl',
# Header (aux-nav, masthead, site-nav).
2013-03-19 07:55:13 +04:00
'css/devreg/desktop-account-links.styl',
'css/devreg/header.styl',
# Item rows (used on Dashboard).
2013-03-19 07:55:13 +04:00
'css/devreg/listing.styl',
'css/devreg/legacy-paginator.styl',
# Buttons (used for paginator, "Edit" buttons, Refunds page).
2013-03-19 07:55:13 +04:00
'css/devreg/buttons.styl',
# Popups, Modals, Tooltips.
2013-03-19 07:55:13 +04:00
'css/devreg/overlay.styl',
'css/devreg/popups.styl',
'css/devreg/device.styl',
'css/devreg/tooltips.styl',
# L10n menu ("Localize for ...").
2013-03-19 07:55:13 +04:00
'css/devreg/l10n.styl',
# Forms (used for tables on "Manage ..." pages).
2013-03-19 07:55:13 +04:00
'css/devreg/forms.styl',
2012-12-30 09:55:08 +04:00
# Tables.
2013-03-19 07:55:13 +04:00
'css/devreg/data-grid.styl',
2012-12-30 09:55:08 +04:00
# Landing page
2013-03-19 07:55:13 +04:00
'css/devreg/landing.styl',
# "Manage ..." pages.
2013-03-19 07:55:13 +04:00
'css/devreg/manage.styl',
'css/devreg/prose.styl',
'css/devreg/authors.styl',
'css/devreg/in-app-config.styl',
'css/devreg/payments.styl',
'css/devreg/refunds.styl',
'css/devreg/transactions.styl',
'css/devreg/status.styl',
# Image Uploads (used for "Edit Listing" Images and Submission).
2013-03-19 07:55:13 +04:00
'css/devreg/media.styl',
'css/devreg/invisible-upload.styl',
# Submission.
2013-03-19 07:55:13 +04:00
'css/devreg/submit-progress.styl',
'css/devreg/submit-terms.styl',
'css/devreg/submit-manifest.styl',
'css/devreg/submit-details.styl',
'css/devreg/validation.styl',
'css/devreg/submit.styl',
'css/devreg/tabs.styl',
# Developer Log In / Registration.
2013-03-19 07:55:13 +04:00
'css/devreg/login.styl',
# Footer.
2013-03-19 07:55:13 +04:00
'css/devreg/footer.styl',
),
'mkt/reviewers': (
'css/zamboni/editors.css',
2013-03-19 07:55:13 +04:00
'css/devreg/consumer-buttons.styl',
'css/devreg/ratings.styl',
'css/devreg/data-grid.styl',
'css/devreg/reviewers.styl',
'css/devreg/themes_review.styl',
'css/devreg/legacy-paginator.styl',
'css/devreg/files.styl',
),
2012-11-30 01:43:37 +04:00
'mkt/splash': (
'css/mkt/splash.styl',
2012-11-30 01:43:37 +04:00
),
'mkt/consumer': (
'css/mkt/reset.styl',
'css/mkt/typography.styl',
'css/mkt/site.styl',
'css/mkt/banners.styl',
'css/mkt/forms.styl',
'css/mkt/header.styl',
'css/mkt/account-links.styl',
'css/mkt/buttons.styl',
'css/mkt/tile.styl',
'css/mkt/notification.styl',
'css/mkt/detail.styl',
'css/mkt/ratings.styl',
'css/mkt/abuse.styl',
'css/mkt/categories.styl',
'css/mkt/menu.styl',
'css/mkt/infobox.styl',
'css/mkt/promo-grid.styl',
'css/mkt/overlay.styl',
'css/mkt/search.styl',
'css/mkt/paginator.styl',
'css/mkt/suggestions.styl',
'css/mkt/account.styl',
'css/mkt/login.styl',
'css/mkt/purchase.styl',
'css/mkt/lightbox.styl',
'css/mkt/filters.styl',
),
2012-04-25 04:15:49 +04:00
'mkt/ecosystem': (
2013-03-19 07:55:13 +04:00
'css/devreg/reset.styl',
'css/devreg/consumer-typography.styl',
'css/devreg/login.styl',
'css/devreg/forms.styl',
'css/ecosystem/landing.styl',
'css/ecosystem/documentation.styl',
),
'mkt/in-app-payments': (
2013-03-19 07:55:13 +04:00
'css/devreg/reset.styl',
'css/devreg/consumer-typography.styl',
'css/devreg/buttons.styl',
'css/devreg/in-app-payments.styl',
),
2012-03-28 12:25:01 +04:00
'mkt/stats': (
2013-03-19 07:55:13 +04:00
'css/devreg/legacy-paginator.styl',
'css/devreg/jquery-ui/jquery-ui-1.10.1.custom.css',
2013-03-19 07:55:13 +04:00
'css/devreg/stats.styl',
2012-03-28 12:25:01 +04:00
),
2012-06-27 22:52:48 +04:00
'mkt/lookup': (
2013-03-19 07:55:13 +04:00
'css/devreg/lookup-tool.styl',
'css/devreg/activity.styl',
),
'mkt/gaia': (
# Gaia building blocks.
'css/gaia/action_menu.css',
'css/gaia/switches.css',
'css/gaia/value_selector.css',
)
}
# Bundle extensions (e.g., desktop).
CSS.update({
'mkt/consumer-desktop': CSS['mkt/consumer'] + (
# TODO: Split components into individual, appropriate stylesheets.
'css/mkt/desktop.styl',
'css/mkt/desktop-tile.styl',
'css/mkt/desktop-filters.styl',
'css/mkt/desktop-forms.styl',
'css/mkt/desktop-account.styl',
'css/mkt/desktop-listing.styl',
'css/mkt/desktop-details.styl',
'css/mkt/desktop-ratings.styl',
2012-12-31 20:50:07 +04:00
),
})
JS = {
'mkt/devreg': (
2012-11-29 02:06:58 +04:00
# tiny module loader
'js/lib/amd.js',
2013-02-15 04:38:33 +04:00
'js/lib/jquery-1.9.1.js',
'js/lib/underscore.js',
2013-03-01 05:08:34 +04:00
'js/lib/format.js',
'js/lib/jquery.cookie.js',
'js/lib/stick.js',
'js/lib/csrf.js',
'js/common/fakefilefield.js',
2013-02-22 04:55:54 +04:00
'js/mkt/gettext.js',
2012-12-18 05:12:58 +04:00
'js/mkt/tracking.js',
'js/devreg/init.js', # This one excludes buttons initialization, etc.
2013-03-01 05:08:34 +04:00
'js/mkt/modal.js',
'js/mkt/overlay.js',
'js/mkt/capabilities.js',
'js/devreg/slugify.js',
'js/devreg/formdata.js',
2013-03-01 05:08:34 +04:00
'js/devreg/tooltip.js',
'js/devreg/popup.js',
'js/mkt/login.js',
2012-12-05 08:03:15 +04:00
'js/mkt/notification.js',
2013-03-01 05:08:34 +04:00
'js/mkt/outgoing_links.js',
'js/mkt/utils.js',
2013-03-01 05:08:34 +04:00
'js/impala/serializers.js',
'js/common/keys.js',
'js/common/upload-base.js',
'js/common/upload-packaged-app.js',
2012-03-29 00:39:34 +04:00
'js/common/upload-image.js',
2013-03-01 05:08:34 +04:00
'js/devreg/l10n.js',
# jQuery UI
'js/lib/jquery-ui/jquery-ui-1.10.1.custom.js',
'js/lib/jquery.minicolors.js',
'js/devreg/devhub.js',
'js/devreg/submit.js',
'js/devreg/tabs.js',
'js/devreg/edit.js',
2013-03-01 05:08:34 +04:00
'js/devreg/validator.js',
# Specific stuff for making payments nicer.
2013-01-31 04:05:51 +04:00
'js/devreg/payments-enroll.js',
'js/devreg/payments-manage.js',
'js/devreg/payments.js',
2012-12-05 08:03:15 +04:00
2013-04-03 04:33:50 +04:00
# For testing installs.
'js/mkt/apps.js',
'js/devreg/test-install.js',
2012-12-05 08:03:15 +04:00
# Module initialization.
2012-12-05 11:15:35 +04:00
'js/devreg/devreg_init.js',
),
'mkt/consumer': (
# tiny module loader
'js/lib/amd.js',
2013-02-15 04:38:33 +04:00
'js/lib/jquery-1.9.1.js',
2012-11-02 02:57:00 +04:00
'js/lib/jquery.cookie.js',
2012-03-15 05:20:45 +04:00
'js/lib/underscore.js',
'js/lib/format.js',
# slider lib
'js/lib/flipsnap.js',
2012-12-18 05:12:58 +04:00
'js/mkt/tracking.js',
2012-04-26 02:21:22 +04:00
'js/mkt/utils.js',
2012-05-12 11:03:45 +04:00
'js/lib/csrf.js',
2013-02-22 04:55:54 +04:00
'js/mkt/gettext.js',
'js/zamboni/browser.js',
'js/mkt/init.js',
'js/lib/truncate.js',
'js/zamboni/truncation.js',
'js/common/keys.js',
'js/mkt/capabilities.js',
'js/mkt/banners.js',
'js/impala/serializers.js',
'js/mkt/potatocaptcha.js',
'js/mkt/overlay.js',
2012-04-10 05:01:10 +04:00
'js/mkt/login.js',
2012-03-15 05:20:45 +04:00
'js/mkt/install.js',
2012-03-24 01:05:32 +04:00
'js/mkt/payments.js',
'js/mkt/buttons.js',
2012-03-17 02:23:09 +04:00
'js/mkt/search.js',
'js/mkt/apps.js',
2013-02-25 22:17:26 +04:00
'js/mkt/header.js',
# ui
'js/mkt/notification.js',
# Search suggestions.
'js/impala/ajaxcache.js',
'js/impala/suggestions.js',
'js/mkt/mkt_suggestions.js',
# Account settings.
'js/mkt/account.js',
2013-01-02 21:07:02 +04:00
'js/mkt/feedback.js',
# Fix-up outgoing links.
'js/mkt/outgoing_links.js',
2012-05-02 03:48:08 +04:00
# Stick.
'js/lib/stick.js',
2012-11-29 05:45:53 +04:00
2012-12-07 02:11:05 +04:00
'js/mkt/prefetch.js',
2012-11-29 05:45:53 +04:00
# Module initialization.
2012-12-05 08:03:15 +04:00
'js/mkt/consumer_init.js',
),
'mkt/reviewers': (
'js/lib/highcharts.src.js',
'js/zamboni/storage.js',
'js/zamboni/editors.js',
'js/impala/formset.js',
'js/lib/jquery.hoverIntent.js',
'js/lib/jquery.zoomBox.js',
'js/mkt/themes_review.js',
'js/mkt/apps.js',
2013-01-16 01:48:05 +04:00
'js/mkt/payments.js',
'js/mkt/install.js',
'js/mkt/buttons.js',
'js/mkt/reviewers.js',
'js/devreg/expandable.js',
'js/devreg/mobile_review_actions.js',
'js/common/fakefilefield.js',
'js/common/formsets.js',
2013-06-20 03:21:34 +04:00
'js/common/buckets.js',
2013-01-16 01:48:05 +04:00
'js/devreg/reviewers_init.js',
),
2012-03-28 12:25:01 +04:00
'mkt/stats': (
2012-06-19 00:23:35 +04:00
'js/zamboni/storage.js',
2012-03-28 12:25:01 +04:00
'js/mkt/modal.js',
'js/lib/highcharts.src.js',
2012-05-15 21:54:28 +04:00
'js/mkt/stats/csv_keys.js',
'js/mkt/stats/helpers.js',
'js/mkt/stats/dateutils.js',
'js/mkt/stats/manager.js',
'js/mkt/stats/controls.js',
'js/mkt/stats/overview.js',
'js/mkt/stats/topchart.js',
'js/mkt/stats/chart.js',
'js/mkt/stats/table.js',
'js/mkt/stats/chart_column.js',
2012-05-15 21:54:28 +04:00
'js/mkt/stats/stats.js',
2012-03-28 12:25:01 +04:00
),
'mkt/in-app-payments': (
2013-02-15 04:38:33 +04:00
'js/lib/jquery-1.9.1.js',
'js/mkt/inapp_payments.js',
2012-05-12 11:03:45 +04:00
'js/lib/csrf.js',
2012-05-05 00:34:48 +04:00
'js/impala/serializers.js',
2012-04-17 03:30:16 +04:00
'js/mkt/login.js',
),
2012-06-27 22:52:48 +04:00
'mkt/lookup': (
'js/common/keys.js',
'js/impala/ajaxcache.js',
'js/impala/suggestions.js',
2012-06-27 22:52:48 +04:00
'js/mkt/lookup-tool.js',
),
'mkt/ecosystem': (
'js/mkt/ecosystem.js',
),
2012-10-18 03:33:53 +04:00
'mkt/debug': (
'js/debug/tinytools.js',
),
}
2013-02-01 03:04:04 +04:00
JS_desktop = list(JS['mkt/consumer'])
if 'js/mkt/consumer_init.js' in JS_desktop:
JS_desktop.remove('js/mkt/consumer_init.js')
JS_desktop = tuple(JS_desktop)
JS.update({
'mkt/consumer-desktop': JS_desktop + (
# This must be the last JS file defined!
'js/mkt/consumer_init.js',
),
})
2013-02-15 17:58:15 +04:00
def jquery_migrated():
new_JS = dict(JS)
for bundle, files in new_JS.iteritems():
files = list(files)
try:
jquery = files.index('js/lib/jquery-1.9.1.js')
except ValueError:
continue
# Insert jquery-migrate immediately after jquery (before any files
# requiring jquery are loaded).
files.insert(jquery + 1, 'js/lib/jquery-migrate-1.1.0.js')
new_JS[bundle] = tuple(files)
return new_JS
2013-03-13 03:04:25 +04:00
def less2stylus():
"""
This will return a dict of the CSS bundles with `.styl` stylesheets
instead of `.less` ones.
Put in your local settings::
try:
MINIFY_BUNDLES['css'].update(asset_bundles.less2stylus())
except AttributeError:
pass
"""
import os
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def stylus(fn):
fn_styl = fn.replace('.less', '.styl')
if os.path.exists(os.path.join(ROOT, 'media', fn_styl)):
fn = fn_styl
return fn
new_CSS = dict(CSS)
for bundle, files in new_CSS.iteritems():
new_CSS[bundle] = tuple(stylus(f) for f in files)
return new_CSS