mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
Run the CSS through webpack so we can pull in CSS files from modules with require rather than symlinking into the node_module directory which is breaking people on different npm versions.
This commit is contained in:
parent
819b80d30f
commit
7ff5e42f3e
7 changed files with 21 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,4 +4,4 @@ lib
|
||||||
.DS_Store
|
.DS_Store
|
||||||
key.pem
|
key.pem
|
||||||
cert.pem
|
cert.pem
|
||||||
build
|
vector/components.css
|
||||||
|
|
11
package.json
11
package.json
|
@ -12,22 +12,25 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"reskindex": "reskindex vector -h src/skins/vector/header",
|
"reskindex": "reskindex vector -h src/skins/vector/header",
|
||||||
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
||||||
"build:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/bundle.css -c uglifycss --no-watch",
|
"build:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css --no-watch",
|
||||||
"build:compile": "babel --source-maps -d lib src",
|
"build:compile": "babel --source-maps -d lib src",
|
||||||
"build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js",
|
"build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js",
|
||||||
"build": "npm run build:css && npm run build:compile && npm run build:bundle",
|
"build": "npm run build:css && npm run build:compile && npm run build:bundle",
|
||||||
"start:js": "webpack -w src/vector/index.js vector/bundle.js",
|
"start:js": "webpack -w src/vector/index.js vector/bundle.js",
|
||||||
"start:skins:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/bundle.css",
|
"start:skins:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css",
|
||||||
"//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270",
|
"//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270",
|
||||||
"start": "parallelshell \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"",
|
"start": "parallelshell \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"",
|
||||||
"clean": "rimraf lib vector/bundle.css vector/bundle.js vector/bundle.js.map",
|
"clean": "rimraf lib vector/bundle.css vector/bundle.js vector/bundle.js.map vector/webpack.css*",
|
||||||
"prepublish": "npm run build:css && npm run build:compile"
|
"prepublish": "npm run build:css && npm run build:compile"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classnames": "^2.1.2",
|
"classnames": "^2.1.2",
|
||||||
|
"extract-text-webpack-plugin": "^0.9.1",
|
||||||
"filesize": "^3.1.2",
|
"filesize": "^3.1.2",
|
||||||
"flux": "~2.0.3",
|
"flux": "~2.0.3",
|
||||||
|
"gemini-scrollbar": "^1.3.0",
|
||||||
"gfm.css": "^1.1.1",
|
"gfm.css": "^1.1.1",
|
||||||
|
"highlight.js": "^8.9.1",
|
||||||
"linkifyjs": "^2.0.0-beta.4",
|
"linkifyjs": "^2.0.0-beta.4",
|
||||||
"matrix-js-sdk": "https://github.com/matrix-org/matrix-js-sdk.git#develop",
|
"matrix-js-sdk": "https://github.com/matrix-org/matrix-js-sdk.git#develop",
|
||||||
"matrix-react-sdk": "https://github.com/matrix-org/matrix-react-sdk.git#develop",
|
"matrix-react-sdk": "https://github.com/matrix-org/matrix-react-sdk.git#develop",
|
||||||
|
@ -44,12 +47,12 @@
|
||||||
"babel-core": "^5.8.25",
|
"babel-core": "^5.8.25",
|
||||||
"babel-loader": "^5.3.2",
|
"babel-loader": "^5.3.2",
|
||||||
"catw": "^1.0.1",
|
"catw": "^1.0.1",
|
||||||
|
"css-raw-loader": "^0.1.1",
|
||||||
"http-server": "^0.8.4",
|
"http-server": "^0.8.4",
|
||||||
"json-loader": "^0.5.3",
|
"json-loader": "^0.5.3",
|
||||||
"parallelshell": "^1.2.0",
|
"parallelshell": "^1.2.0",
|
||||||
"rimraf": "^2.4.3",
|
"rimraf": "^2.4.3",
|
||||||
"source-map-loader": "^0.1.5",
|
"source-map-loader": "^0.1.5",
|
||||||
"uglifycss": "0.0.15",
|
|
||||||
"webpack": "^1.12.6"
|
"webpack": "^1.12.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../../../../node_modules/react-gemini-scrollbar/node_modules/gemini-scrollbar/gemini-scrollbar.css
|
|
|
@ -1 +0,0 @@
|
||||||
../../../../node_modules/gfm.css/gfm.css
|
|
|
@ -1 +0,0 @@
|
||||||
../../../../node_modules/highlight.js/styles/github.css
|
|
|
@ -16,6 +16,13 @@ limitations under the License.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// CSS requires: just putting them here for now as CSS is going to be
|
||||||
|
// refactored soon anyway
|
||||||
|
require('../../vector/components.css');
|
||||||
|
require('gemini-scrollbar/gemini-scrollbar.css');
|
||||||
|
require('gfm.css/gfm.css');
|
||||||
|
require('highlight.js/styles/github.css');
|
||||||
|
|
||||||
var RunModernizrTests = require("./modernizr"); // this side-effects a global
|
var RunModernizrTests = require("./modernizr"); // this side-effects a global
|
||||||
var React = require("react");
|
var React = require("react");
|
||||||
var ReactDOM = require("react-dom");
|
var ReactDOM = require("react-dom");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
|
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
module: {
|
module: {
|
||||||
|
@ -9,6 +10,8 @@ module.exports = {
|
||||||
loaders: [
|
loaders: [
|
||||||
{ test: /\.json$/, loader: "json" },
|
{ test: /\.json$/, loader: "json" },
|
||||||
{ test: /\.js$/, loader: "babel", include: path.resolve('./src') },
|
{ test: /\.js$/, loader: "babel", include: path.resolve('./src') },
|
||||||
|
// css-raw-loader loads CSS but doesn't try to treat url()s as require()s
|
||||||
|
{ test: /\.css$/, loader: ExtractTextPlugin.extract("css-raw-loader") },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
@ -37,6 +40,9 @@ module.exports = {
|
||||||
'process.env': {
|
'process.env': {
|
||||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
new ExtractTextPlugin("bundle.css", {
|
||||||
|
allChunks: true
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
devtool: 'source-map'
|
devtool: 'source-map'
|
||||||
|
|
Loading…
Reference in a new issue