Commit ac801833 by Eric Fischer

Add studio-frontend to studio, if waffle flag set

parent a830073b
...@@ -95,6 +95,7 @@ lms/static/css/ ...@@ -95,6 +95,7 @@ lms/static/css/
lms/static/certificates/css/ lms/static/certificates/css/
cms/static/css/ cms/static/css/
common/static/common/js/vendor/ common/static/common/js/vendor/
common/static/common/css/vendor/
common/static/bundles common/static/bundles
webpack-stats.json webpack-stats.json
......
...@@ -13,13 +13,19 @@ ...@@ -13,13 +13,19 @@
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%block name="header_extras"> <%block name="header_extras">
% for template_name in ["asset"]: % if waffle_flag_enabled:
<script type="text/template" id="${template_name}-tpl"> <link rel="stylesheet" type="text/css" href="${static.url('common/css/vendor/studio-frontend.min.css')}" />
<%static:include path="js/${template_name}.underscore" /> <script type="text/javascript" src="${static.url('common/js/vendor/assets.min.js')}" defer></script>
</script> % else:
% endfor % for template_name in ["asset"]:
<script type="text/template" id="${template_name}-tpl">
<%static:include path="js/${template_name}.underscore" />
</script>
% endfor
% endif
</%block> </%block>
% if not waffle_flag_enabled:
<%block name="requirejs"> <%block name="requirejs">
require(["js/factories/asset_index"], function (AssetIndexFactory) { require(["js/factories/asset_index"], function (AssetIndexFactory) {
AssetIndexFactory({ AssetIndexFactory({
...@@ -30,6 +36,7 @@ ...@@ -30,6 +36,7 @@
}); });
}); });
</%block> </%block>
% endif
<%block name="content"> <%block name="content">
...@@ -53,7 +60,11 @@ ...@@ -53,7 +60,11 @@
<div class="wrapper-content wrapper"> <div class="wrapper-content wrapper">
<div class="content"> <div class="content">
<div class="content-primary"> <div class="content-primary">
<div class="wrapper-assets"> </div> % if waffle_flag_enabled:
<div id="root"></div>
% else:
<div class="wrapper-assets"></div>
% endif
<div class="ui-loading"> <div class="ui-loading">
<p><span class="spin"><span class="icon fa fa-refresh" aria-hidden="true"></span></span> <span class="copy">${_("Loading")}</span></p> <p><span class="spin"><span class="icon fa fa-refresh" aria-hidden="true"></span></span> <span class="copy">${_("Loading")}</span></p>
</div> </div>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"backbone.paginator": "~2.0.3", "backbone.paginator": "~2.0.3",
"coffee-loader": "^0.7.3", "coffee-loader": "^0.7.3",
"coffee-script": "1.6.1", "coffee-script": "1.6.1",
"@edx/studio-frontend": "0.1.0",
"edx-bootstrap": "^0.2.1", "edx-bootstrap": "^0.2.1",
"edx-pattern-library": "0.18.1", "edx-pattern-library": "0.18.1",
"edx-ui-toolkit": "1.5.2", "edx-ui-toolkit": "1.5.2",
......
...@@ -64,6 +64,10 @@ NPM_INSTALLED_LIBRARIES = [ ...@@ -64,6 +64,10 @@ NPM_INSTALLED_LIBRARIES = [
'requirejs/require.js', 'requirejs/require.js',
'underscore.string/dist/underscore.string.js', 'underscore.string/dist/underscore.string.js',
'underscore/underscore.js', 'underscore/underscore.js',
'@edx/studio-frontend/dist/assets.min.js',
'@edx/studio-frontend/dist/assets.min.js.map',
'@edx/studio-frontend/dist/studio-frontend.min.css',
'@edx/studio-frontend/dist/studio-frontend.min.css.map'
] ]
# A list of NPM installed developer libraries that should be copied into the common # A list of NPM installed developer libraries that should be copied into the common
...@@ -74,7 +78,9 @@ NPM_INSTALLED_DEVELOPER_LIBRARIES = [ ...@@ -74,7 +78,9 @@ NPM_INSTALLED_DEVELOPER_LIBRARIES = [
] ]
# Directory to install static vendor files # Directory to install static vendor files
NPM_VENDOR_DIRECTORY = path('common/static/common/js/vendor') NPM_JS_VENDOR_DIRECTORY = path('common/static/common/js/vendor')
NPM_CSS_VENDOR_DIRECTORY = path("common/static/common/css/vendor")
NPM_CSS_DIRECTORY = path("common/static/common/css")
# system specific lookup path additions, add sass dirs if one system depends on the sass files for other systems # system specific lookup path additions, add sass dirs if one system depends on the sass files for other systems
SASS_LOOKUP_DEPENDENCIES = { SASS_LOOKUP_DEPENDENCIES = {
...@@ -604,10 +610,14 @@ def process_npm_assets(): ...@@ -604,10 +610,14 @@ def process_npm_assets():
Copies a vendor library to the shared vendor directory. Copies a vendor library to the shared vendor directory.
""" """
library_path = 'node_modules/{library}'.format(library=library) library_path = 'node_modules/{library}'.format(library=library)
if library.endswith('.css') or library.endswith('.css.map'):
vendor_dir = NPM_CSS_VENDOR_DIRECTORY
else:
vendor_dir = NPM_JS_VENDOR_DIRECTORY
if os.path.exists(library_path): if os.path.exists(library_path):
sh('/bin/cp -rf {library_path} {vendor_dir}'.format( sh('/bin/cp -rf {library_path} {vendor_dir}'.format(
library_path=library_path, library_path=library_path,
vendor_dir=NPM_VENDOR_DIRECTORY, vendor_dir=vendor_dir,
)) ))
elif not skip_if_missing: elif not skip_if_missing:
raise Exception('Missing vendor file {library_path}'.format(library_path=library_path)) raise Exception('Missing vendor file {library_path}'.format(library_path=library_path))
...@@ -618,7 +628,9 @@ def process_npm_assets(): ...@@ -618,7 +628,9 @@ def process_npm_assets():
return return
# Ensure that the vendor directory exists # Ensure that the vendor directory exists
NPM_VENDOR_DIRECTORY.mkdir_p() NPM_JS_VENDOR_DIRECTORY.mkdir_p()
NPM_CSS_DIRECTORY.mkdir_p()
NPM_CSS_VENDOR_DIRECTORY.mkdir_p()
# Copy each file to the vendor directory, overwriting any existing file. # Copy each file to the vendor directory, overwriting any existing file.
print("Copying vendor files into static directory") print("Copying vendor files into static directory")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment