Skip to content

Instantly share code, notes, and snippets.

View adeelibr's full-sized avatar
🥋
doing bat shit crazy stuff with code

Adeel Imran adeelibr

🥋
doing bat shit crazy stuff with code
View GitHub Profile
@adeelibr
adeelibr / webpack.base.config.js
Created April 22, 2018 13:39
Webpack base configuration file with SCSS, HTML, .JS with react support
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
@adeelibr
adeelibr / styles.scss
Created April 22, 2018 14:10
Some basic styling example for webpack 4 tutorial
body {
background-color: crimson;
color: yellow;
font-size: 16px;
}
h3, p {
text-align: center;
}
@adeelibr
adeelibr / package.json
Created April 22, 2018 14:19
dev script for webpack tutorial
"scripts": {
"start:dev": "webpack-dev-server --mode development --config config/webpack.base.config.js --open --hot --history-api-fallback"
}
@adeelibr
adeelibr / package.json
Created April 22, 2018 17:14
production script for webpack config
"scripts": {
"start:dev": "webpack-dev-server --mode development --config config/webpack.base.config.js --open --hot --history-api-fallback",
"start:prod": "webpack --mode production --config config/webpack.prod.config.js --progress"
},
@adeelibr
adeelibr / webpack.opt.config.js
Created April 22, 2018 19:44
A webpack optimization file
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
mangle: {
keep_fnames: true,
@adeelibr
adeelibr / webpack.prod.config.js
Created April 22, 2018 20:10
Webpack production file using .base and .opt file
var webpack = require('webpack');
var merge = require('webpack-merge');
var baseConfig = require('./webpack.base.config');
var optimizationConfig = require('./webpack.opt.config');
const productionConfiguration = function (env) {
const NODE_ENV = env.NODE_ENV ? env.NODE_ENV : 'development';
return {
plugins: [
"scripts": {
"start:dev": "webpack-dev-server --mode development --config config/webpack.base.config.js --open --hot --history-api-fallback",
"prestart:prod": "webpack --mode production --config config/webpack.prod.config.js --env.NODE_ENV=production --progress",
"start:prod": "node server"
},
@adeelibr
adeelibr / index.js
Created April 22, 2018 20:38
Node server basic bare bone file
const express = require('express');
const path = require('path');
const http = require('http');
const app = express();
// Point static path to dist
app.use(express.static(path.join(__dirname, '..', 'dist')));
const routes = require('./routes')
@adeelibr
adeelibr / index.js
Created April 22, 2018 20:43
Express JS routes file for spa
const path = require('path');
const router = require('express').Router();
router
.get('/*', (req, res, next) => {
const routePath = path.join(__dirname + '..', '..', '..', 'dist/' + 'index.html');
res.sendFile(routePath);
})
module.exports = router;
@adeelibr
adeelibr / prepack-gentle-intro-1.md
Created May 14, 2018 06:28 — forked from gaearon/prepack-gentle-intro-1.md
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.