Separate development and production build.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Manuel Friedli 2019-05-08 01:28:16 +02:00
parent f01d10b81d
commit 5f5bc2256e
10 changed files with 1223 additions and 53 deletions

View file

@ -9,4 +9,4 @@ steps:
- name: build
image: node:12
commands:
- npm run build
- npm run build:prod

1
dist/uhr.js vendored

File diff suppressed because one or more lines are too long

1
dist/uhr.js.map vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -22,13 +22,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<meta name="apple-mobile-web-app-title" content="Bärneruhr"/>
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr.css"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-black.css" data-class="black" data-name="Schwarz"/>
<link rel="stylesheet" type="text/css" href="css/uhr-white.css" data-class="white" data-name="Weiss"/>
<link rel="stylesheet" type="text/css" href="css/uhr-red.css" data-class="red" data-name="Rot"/>
<link rel="stylesheet" type="text/css" href="css/uhr-yellow.css" data-class="yellow" data-name="Gelb"/>
<link rel="stylesheet" type="text/css" href="css/uhr-green.css" data-class="green" data-name="Grün"/>
<link rel="stylesheet" type="text/css" href="css/uhr-blue.css" data-class="blue" data-name="Blau"/>
<link rel="stylesheet" type="text/css" href="css/uhr-pink.css" data-class="pink" data-name="Pink"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-black.css" data-class="black"
data-name="Schwarz"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-white.css" data-class="white"
data-name="Weiss"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-red.css" data-class="red" data-name="Rot"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-yellow.css" data-class="yellow"
data-name="Gelb"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-green.css" data-class="green"
data-name="Grün"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-blue.css" data-class="blue"
data-name="Blau"/>
<link rel="stylesheet" type="text/css" href="dist/assets/uhr-pink.css" data-class="pink"
data-name="Pink"/>
<link rel="shortcut icon" type="image/png" href="resources/favicon.png"/>
<link rel="apple-touch-icon-precomposed" href="resources/apple-touch-icon-precomposed.png"/>
<script

View file

@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<title>Die Zeit im Wort - Informationen</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="../css/uhr.css"/>
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black"/>
<link rel="stylesheet" type="text/css" href="../css/uhr-red.css" data-class="red"/>
<link rel="stylesheet" type="text/css" href="../dist/assets/uhr.css"/>
<link rel="stylesheet" type="text/css" href="../dist/assets/uhr-black.css" data-class="black"/>
<link rel="stylesheet" type="text/css" href="../dist/assets/uhr-red.css" data-class="red"/>
<link rel="stylesheet" type="text/css" href="info.css"/>
<link rel="shortcut icon" type="image/png" href="../resources/favicon.png"/>
<script

1156
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -23,8 +23,9 @@
],
"license": "GPL-3.0",
"scripts": {
"build-debug": "webpack -d",
"build": "webpack"
"start": "webpack-dev-server --open --config webpack.dev.js",
"build": "webpack --mode development --env development --config webpack.dev.js",
"build:prod": "webpack -p --mode production --env production --config webpack.prod.js"
},
"dependencies": {
"jquery": "3.4.1",
@ -52,6 +53,8 @@
"ts-loader": "5.4.5",
"typescript": "3.4.5",
"webpack": "4.30.0",
"webpack-cli": "3.3.1"
"webpack-cli": "3.3.1",
"webpack-dev-server": "3.3.1",
"webpack-merge": "4.2.1"
}
}

View file

@ -1,7 +1,7 @@
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
module.exports = (env, argv) => ({
entry: {
uhr: './src/index.ts',
style_main: require.resolve('./resources/styles/uhr.scss'),
@ -14,8 +14,6 @@ module.exports = {
style_yellow: require.resolve('./css/uhr-yellow.css')
},
// devtool: 'inline-source-map',
mode: 'production',
module: {
rules: [
{
@ -35,32 +33,35 @@ module.exports = {
}
]
},
//////
{
test: /\.s?css$/,
use: [
{
loader: 'file-loader',
options: {
name: 'assets/[name].css'
use: argv.mode !== 'production' ?
[
'style-loader',
'css-loader',
'sass-loader'
] :
[
{
loader: 'file-loader',
options: {
name: 'assets/[name].css'
}
},
{
loader: 'extract-loader',
options: {
publicPath: '../',
}
},
'css-loader',
{
loader: 'sass-loader',
options: {
outputStyle: 'compressed'
}
}
},
{
loader: 'extract-loader',
options: {
publicPath: '../',
}
},
'css-loader',
{
loader: 'sass-loader',
options: {
outputStyle: 'compressed'
}
}
]
]
},
// {
// test: /\.s?css$/,
@ -80,16 +81,15 @@ module.exports = {
},
plugins: [
new CleanWebpackPlugin({
dry: false,
cleanAfterEveryBuildPatterns: ['**/deleteme_*.del'],
dangerouslyAllowCleanPatternsOutsideProject: false
cleanAfterEveryBuildPatterns: ['**/*.deleteme'],
protectWebpackAssets: false
})
],
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: (chunkData) => chunkData.chunk.name === 'uhr' ? 'uhr.js' : 'deleteme_[name].del',
filename: (chunkData) => chunkData.chunk.name === 'uhr' ? 'uhr.js' : '[name].deleteme',
library: 'uhr',
path: path.resolve(__dirname, 'dist')
},
@ -97,4 +97,4 @@ module.exports = {
jquery: 'jQuery',
'js-cookie': 'Cookies'
}
};
});

10
webpack.dev.js Normal file
View file

@ -0,0 +1,10 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = (env, argv) => merge(common(env, argv), {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: './dist'
}
});

7
webpack.prod.js Normal file
View file

@ -0,0 +1,7 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = (env, argv) => merge(common(env, argv), {
mode: 'production',
devtool: 'source-map'
});