Skip to content

Instantly share code, notes, and snippets.

@b-tiwari
b-tiwari / dabblet.css
Last active February 14, 2016 22:00
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #fff;
background: linear-gradient(45deg, #fff, grey);
min-height: 100%;
@b-tiwari
b-tiwari / app.js
Created May 6, 2017 00:21
scripts/src/app.js
console.log('Welcome from app.js');
@b-tiwari
b-tiwari / package.json
Created May 6, 2017 01:23
learn-webpack2/package.json
{
"name": "learn-webpack2",
"version": "1.0.0",
"description": "learn webpack2",
"main": "index.js",
"scripts": {
"start": "webpack ./src/scripts/app.js ./dist/app.bundle.js"
},
"author": "Bharat Tiwari",
"license": "ISC"
@b-tiwari
b-tiwari / webpack.config.js
Created May 6, 2017 02:52
learn-webpack2/webpack/webpack.config.js
module.exports = {
entry: "./src/scripts/app.js",//path relative to this file
output: {
filename: "./dist/app.bundle.js"//path relative to this file
}
}
@b-tiwari
b-tiwari / index.html
Created May 6, 2017 05:27
webpack2 Beginners Guide - dist/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Awesome application</title>
</head>
<body>
<h1>Hello World</h1>
@b-tiwari
b-tiwari / webpack.config.js
Created May 6, 2017 05:49
Webpack2 Beginners guide - webpack.config.js
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: "./src/scripts/app.js", //relative to root of the application
output: {
filename: "./dist/app.bundle.js" //relative to root of the application
},
plugins: [
new HtmlWebpackPlugin({
@b-tiwari
b-tiwari / index.html
Created May 6, 2017 06:14
src/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<h1> <%= htmlWebpackPlugin.options.myPageHeader %> </h1>
<h3>Welcome to the Awesome application</h3>
@b-tiwari
b-tiwari / webpack.config.js
Created May 6, 2017 06:21
webpack.config.js
...
...
plugins: [
new HtmlWebpackPlugin({
hash: true,
title: 'My Awesome application',
myPageHeader: 'Hello World',
template: './src/index.html',
filename: './dist/index.html' //relative to root of the application
})
@b-tiwari
b-tiwari / webpack.config.js
Created May 6, 2017 13:15
webpack2 Beginners Guide - enable watch mode - webpack.config.js
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: "./src/scripts/app.js", //relative to root of the application
output: {
filename: "./dist/app.bundle.js" //relative to root of the application
},
watch:true,
plugins: [
@b-tiwari
b-tiwari / my-helper-module.js
Created May 6, 2017 13:32
Webpack2 Beginners guide - ./src/scripts/my-helper-module.js
module.exports = {
greetings: 'Hello from my-helper-module!!'
};