roll-out webpack (successful SASS, coffee not confirmed)
This commit is contained in:
parent
2ec59c5b21
commit
b62faa0530
21 changed files with 95 additions and 125 deletions
|
@ -1,3 +1,7 @@
|
|||
node_modules
|
||||
npm-debug.log
|
||||
**/*.xcf
|
||||
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
docker-compose.yml
|
||||
|
|
29
Dockerfile
29
Dockerfile
|
@ -1,20 +1,17 @@
|
|||
FROM node:latest
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install app dependencies
|
||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||
# where available (npm@5+)
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
# If you are building your code for production
|
||||
# RUN npm install --only=production
|
||||
|
||||
# Bundle app source
|
||||
COPY . .
|
||||
|
||||
# some dir for our code
|
||||
WORKDIR /app
|
||||
# container port
|
||||
EXPOSE 8080
|
||||
|
||||
CMD [ "npm", "start" ]
|
||||
# install dependencies
|
||||
COPY package*.json .
|
||||
RUN yarn
|
||||
|
||||
# copy code
|
||||
COPY . .
|
||||
RUN yarn build
|
||||
|
||||
# this is how we start
|
||||
CMD ["yarn", "start"]
|
||||
|
|
2
client/lib/10-jquery-3.3.1.min.js
vendored
2
client/lib/10-jquery-3.3.1.min.js
vendored
File diff suppressed because one or more lines are too long
14
client/lib/20-crafty-min.js
vendored
14
client/lib/20-crafty-min.js
vendored
File diff suppressed because one or more lines are too long
69
gulpfile.js
69
gulpfile.js
|
@ -1,69 +0,0 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var merge = require('merge-stream');
|
||||
var gulp = require('gulp');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var coffee = require('gulp-coffee');
|
||||
var sass = require('gulp-sass');
|
||||
var pug = require('gulp-pug');
|
||||
var insert = require('gulp-insert');
|
||||
var uglify = require('gulp-uglify-es').default;
|
||||
var concat = require('gulp-concat');
|
||||
|
||||
var paths = {
|
||||
lib: 'client/lib/*.js',
|
||||
coffee: 'client/scripts',
|
||||
styles: 'client/style/*.scss',
|
||||
pug: 'client/pug/*.pug',
|
||||
dest: 'static',
|
||||
maps: 'maps'
|
||||
};
|
||||
|
||||
gulp.task('lib', function(){
|
||||
return gulp.src(paths.lib)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('lib.min.js'))
|
||||
.pipe(sourcemaps.write(paths.maps))
|
||||
.pipe(gulp.dest(paths.dest))
|
||||
});
|
||||
|
||||
function getFolders(dir) {
|
||||
return fs.readdirSync(dir)
|
||||
.filter(function(file) {
|
||||
return fs.statSync(path.join(dir, file)).isDirectory();
|
||||
});
|
||||
}
|
||||
|
||||
gulp.task('coffee', function(){
|
||||
var folders = getFolders(paths.coffee);
|
||||
|
||||
var tasks = folders.map(function(folder) {
|
||||
return gulp.src(path.join(paths.coffee, folder, '/**/*.coffee'))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat(folder + '.min.js'))
|
||||
.pipe(coffee({bare: true}))
|
||||
.pipe(insert.transform(function(contents, file) {
|
||||
return '$(function () {' + contents + '});';
|
||||
}))
|
||||
.pipe(uglify())
|
||||
.pipe(sourcemaps.write(paths.maps))
|
||||
.pipe(gulp.dest(paths.dest))
|
||||
});
|
||||
|
||||
return merge(tasks);
|
||||
});
|
||||
|
||||
gulp.task('styles', function(){
|
||||
return gulp.src(paths.styles)
|
||||
.pipe(concat('style.css'))
|
||||
.pipe(sass())
|
||||
.pipe(gulp.dest(paths.dest))
|
||||
});
|
||||
|
||||
gulp.task('pug', function(){
|
||||
return gulp.src(paths.pug)
|
||||
.pipe(pug())
|
||||
.pipe(gulp.dest(paths.dest))
|
||||
});
|
||||
|
||||
gulp.task('default', [ 'lib', 'coffee', 'styles', 'pug' ]);
|
24
package.json
24
package.json
|
@ -26,7 +26,6 @@
|
|||
|
||||
"bootstrap": "^4.1.3",
|
||||
"jquery": "^3.3.1",
|
||||
"moment": "^2.22.2",
|
||||
"popper.js": "^1.14.5"
|
||||
},
|
||||
|
||||
|
@ -39,26 +38,3 @@
|
|||
"socket.io": "^2.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.16.1",
|
||||
"helmet": "*",
|
||||
"socket.io": "^2.1.1",
|
||||
"mysql": "*",
|
||||
"bcrypt": "*",
|
||||
"coffeescript": "*",
|
||||
"merge-stream": "*",
|
||||
"gulp": "*",
|
||||
"gulp-sourcemaps": "*",
|
||||
"gulp-pug": "*",
|
||||
"gulp-sass": "*",
|
||||
"gulp-coffee": "*",
|
||||
"gulp-insert": "*",
|
||||
"gulp-uglify-es": "*",
|
||||
"gulp-concat": "*"
|
||||
}
|
||||
}
|
||||
|
|
1
src/game.js
Normal file
1
src/game.js
Normal file
|
@ -0,0 +1 @@
|
|||
import CONF from './scripts/game/10-conf.coffee'
|
6
src/index.js
Normal file
6
src/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import $ from 'jquery'
|
||||
|
||||
// import 'bootstrap'
|
||||
import 'bootstrap/js/dist/carousel'
|
||||
|
||||
import './style/custom.scss'
|
|
@ -41,3 +41,5 @@ CONF =
|
|||
deck: 408
|
||||
dmg: 948
|
||||
dmst: -51
|
||||
|
||||
module.exports = CONF
|
|
@ -1,3 +1,9 @@
|
|||
//
|
||||
// Bootstrap and its default variables
|
||||
//
|
||||
|
||||
@import "node_modules/bootstrap/scss/bootstrap";
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background-color: #aaa;
|
63
webpack.config.js
Normal file
63
webpack.config.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
|
||||
entry: {
|
||||
index: './src/index.js',
|
||||
game: './src/game.js'
|
||||
},
|
||||
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
output: {
|
||||
filename: '[name].bundle.js',
|
||||
path: path.resolve(__dirname, 'static')
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.(scss)$/,
|
||||
use: [{
|
||||
loader: 'style-loader', // inject CSS to page
|
||||
}, {
|
||||
loader: 'css-loader', // translates CSS into CommonJS modules
|
||||
}, {
|
||||
loader: 'postcss-loader', // Run post css actions
|
||||
options: {
|
||||
plugins: function () { // post css plugins, can be exported to postcss.config.js
|
||||
return [
|
||||
require('precss'),
|
||||
require('autoprefixer')
|
||||
];
|
||||
}
|
||||
}
|
||||
}, {
|
||||
loader: 'sass-loader' // compiles Sass to CSS
|
||||
}]
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.coffee$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'coffee-loader',
|
||||
options: {
|
||||
transpile: {
|
||||
presets: ['env']
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
};
|
Reference in a new issue