Commit 9f3f3a50 by Eric Fischer Committed by GitHub

Merge pull request #16111 from edx/dahlia/watch_studio-frontend

Webpack studio frontend
parents fd8a9fdb 45a5e785
...@@ -13,16 +13,11 @@ ...@@ -13,16 +13,11 @@
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%block name="header_extras"> <%block name="header_extras">
% if waffle_flag_enabled:
<link rel="stylesheet" type="text/css" href="${static.url('common/css/vendor/studio-frontend.min.css')}" />
<script type="text/javascript" src="${static.url('common/js/vendor/assets.min.js')}" defer></script>
% else:
% for template_name in ["asset"]: % for template_name in ["asset"]:
<script type="text/template" id="${template_name}-tpl"> <script type="text/template" id="${template_name}-tpl">
<%static:include path="js/${template_name}.underscore" /> <%static:include path="js/${template_name}.underscore" />
</script> </script>
% endfor % endfor
% endif
</%block> </%block>
% if not waffle_flag_enabled: % if not waffle_flag_enabled:
...@@ -62,6 +57,7 @@ ...@@ -62,6 +57,7 @@
<div class="content-primary"> <div class="content-primary">
% if waffle_flag_enabled: % if waffle_flag_enabled:
<div id="root"></div> <div id="root"></div>
<%static:webpack entry="AssetsPage"></%static:webpack>
% else: % else:
<div class="wrapper-assets"></div> <div class="wrapper-assets"></div>
% endif % endif
......
...@@ -4,17 +4,24 @@ ...@@ -4,17 +4,24 @@
"dependencies": { "dependencies": {
"babel-core": "^6.23.0", "babel-core": "^6.23.0",
"babel-loader": "^6.4.0", "babel-loader": "^6.4.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.2.1", "babel-preset-env": "^1.2.1",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"backbone": "~1.3.2", "backbone": "~1.3.2",
"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", "css-loader": "^0.28.5",
"@edx/edx-bootstrap": "0.3.4", "@edx/edx-bootstrap": "0.3.4",
"@edx/paragon": "0.1.0",
"@edx/studio-frontend": "0.2.0",
"edx-pattern-library": "0.18.1", "edx-pattern-library": "0.18.1",
"edx-ui-toolkit": "1.5.2", "edx-ui-toolkit": "1.5.2",
"exports-loader": "^0.6.4", "exports-loader": "^0.6.4",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^1.1.4",
"font-awesome": "^4.7.0",
"hls.js": "0.7.2", "hls.js": "0.7.2",
"imports-loader": "^0.7.1", "imports-loader": "^0.7.1",
"jquery": "~2.2.0", "jquery": "~2.2.0",
...@@ -22,6 +29,7 @@ ...@@ -22,6 +29,7 @@
"jquery.scrollto": "~2.1.2", "jquery.scrollto": "~2.1.2",
"moment": "2.18.1", "moment": "2.18.1",
"moment-timezone": "~0.5.5", "moment-timezone": "~0.5.5",
"node-sass": "^4.5.3",
"picturefill": "~3.0.2", "picturefill": "~3.0.2",
"popper.js": "~1.12.5", "popper.js": "~1.12.5",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
...@@ -30,6 +38,8 @@ ...@@ -30,6 +38,8 @@
"react-dom": "^15.5.4", "react-dom": "^15.5.4",
"requirejs": "~2.3.2", "requirejs": "~2.3.2",
"rtlcss": "^2.2.0", "rtlcss": "^2.2.0",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"string-replace-webpack-plugin": "^0.1.3", "string-replace-webpack-plugin": "^0.1.3",
"uglify-js": "2.7.0", "uglify-js": "2.7.0",
"underscore": "~1.8.3", "underscore": "~1.8.3",
......
...@@ -64,10 +64,6 @@ NPM_INSTALLED_LIBRARIES = [ ...@@ -64,10 +64,6 @@ 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',
'which-country/index.js' 'which-country/index.js'
] ]
......
...@@ -5,9 +5,14 @@ ...@@ -5,9 +5,14 @@
var path = require('path'); var path = require('path');
var webpack = require('webpack'); var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker'); var BundleTracker = require('webpack-bundle-tracker');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var StringReplace = require('string-replace-webpack-plugin'); var StringReplace = require('string-replace-webpack-plugin');
var isProd = process.env.NODE_ENV === 'production'; var isProd = process.env.NODE_ENV === 'production';
var extractSass = new ExtractTextPlugin({
filename: 'css/[name].[contenthash].css',
disable: !isProd
});
var namespacedRequireFiles = [ var namespacedRequireFiles = [
path.resolve(__dirname, 'common/static/common/js/components/views/feedback_notification.js'), path.resolve(__dirname, 'common/static/common/js/components/views/feedback_notification.js'),
...@@ -19,6 +24,7 @@ var wpconfig = { ...@@ -19,6 +24,7 @@ var wpconfig = {
entry: { entry: {
// Studio // Studio
AssetsPage: './node_modules/@edx/studio-frontend/src/index.jsx',
Import: './cms/static/js/features/import/factories/import.js', Import: './cms/static/js/features/import/factories/import.js',
StudioIndex: './cms/static/js/features_jsx/studio/index.jsx', StudioIndex: './cms/static/js/features_jsx/studio/index.jsx',
...@@ -43,6 +49,7 @@ var wpconfig = { ...@@ -43,6 +49,7 @@ var wpconfig = {
devtool: isProd ? false : 'source-map', devtool: isProd ? false : 'source-map',
plugins: [ plugins: [
new ExtractTextPlugin('node_modules/@edx/studio-frontend/dist/studio-frontend.min.css'),
new webpack.NoEmitOnErrorsPlugin(), new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
...@@ -111,6 +118,42 @@ var wpconfig = { ...@@ -111,6 +118,42 @@ var wpconfig = {
use: 'babel-loader' use: 'babel-loader'
}, },
{ {
test: /\.(js|jsx)$/,
include: [
/studio-frontend/,
/paragon/
],
use: 'babel-loader'
},
{
test: /(.scss|.css)$/,
include: [
/studio-frontend/,
/paragon/,
/font-awesome/
],
use: extractSass.extract({
use: [{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]'
}
}, {
loader: 'sass-loader',
options: {
data: '$base-rem-size: 0.625; @import "paragon-reset";',
includePaths: [
path.join(__dirname, './node_modules/@edx/paragon/src/utils'),
path.join(__dirname, './node_modules/')
],
sourceMap: true
}
}],
fallback: 'style-loader'
})
},
{
test: /\.coffee$/, test: /\.coffee$/,
exclude: /node_modules/, exclude: /node_modules/,
use: 'coffee-loader' use: 'coffee-loader'
...@@ -130,6 +173,10 @@ var wpconfig = { ...@@ -130,6 +173,10 @@ var wpconfig = {
'exports-loader?this.AjaxPrefix!../../../../common/static/coffee/src/ajax_prefix.coffee' 'exports-loader?this.AjaxPrefix!../../../../common/static/coffee/src/ajax_prefix.coffee'
} }
} }
},
{
test: /\.(woff2?|ttf|svg|eot)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
} }
] ]
}, },
......
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