Skip to content
This repository has been archived by the owner on Sep 29, 2018. It is now read-only.

Commit

Permalink
🎉 kickstarting commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenautjoe committed Apr 14, 2018
1 parent 060995d commit bbc645c
Show file tree
Hide file tree
Showing 10 changed files with 325 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
/node_modules
dist
28 changes: 28 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Open Book | The open and secure social network.</title>
<!-- Twitter Card data -->
<meta name="twitter:card" value="Open Book">
<meta name="Description" content="The open and secure social network."/>
<!-- Open Graph data -->
<meta property="og:title" content="Open Book" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://www.open-book.org" />
<meta property="og:image" content="" />
<meta property="og:description" content="The open and secure social network." />
<!-- Mobile header color for Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#690ddc">
<!-- Mobile header color Windows Phone -->
<meta name="msapplication-navbutton-color" content="#690ddc">
<!-- Mobile header color for iOS Safari (supports black, black-translucent or default) -->
<meta name="apple-mobile-web-app-status-bar-style" content="default">
</head>
<body>
<!-- Site content STARTS -->

<!-- Site content ENDS -->
</body>
</html>
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "www.open-book.org",
"version": "1.0.0",
"description": "The code for www.open-book.org",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --config webpack.dev.js --mode development",
"build": "webpack --config webpack.prod.js --mode production",
"preview": "npm run build && http-server dist"
},
"repository": {
"type": "git",
"url": "https://github.com/OpenBookOrg/www.open-book.org"
},
"keywords": [],
"author": "Joel Levi Hernandez Fernandez",
"license": "AGPL-3.0-only",
"bugs": {
"url": "https://github.com/OpenBookOrg/www.open-book.org/issues"
},
"homepage": "https://www.open-book.org",
"dependencies": {
"normalize.css": "^8.0.0"
},
"devDependencies": {
"ajv": "^6.3.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"favicons-webpack-plugin": "0.0.8",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.1.0",
"http-server": "^0.11.1",
"node-sass": "^4.8.3",
"optimize-css-assets-webpack-plugin": "^4.0.0",
"postcss-loader": "^2.1.3",
"sass-loader": "^6.0.7",
"source-map-loader": "^0.2.3",
"style-loader": "^0.20.3",
"url-loader": "^1.0.1",
"webpack": "^4.2.0",
"webpack-cli": "^2.0.13",
"webpack-dev-server": "^3.1.1"
}
}
20 changes: 20 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* PostCSS is a tool for transforming styles with JS plugins.
* These plugins can lint your CSS, support variables and mixins, transpile future CSS syntax, inline images, and more.
* https://github.com/postcss/postcss
*/
module.exports = {
plugins: [
/*
* Adds vendor prefixes to css attributes
* https://github.com/postcss/autoprefixer
*/
require('autoprefixer')({
/* It should add vendor prefixes for the last 2 versions of all browsers, meaning old prefixes such as
* -webkit-border-radius: 5px; that the latest browsers support as border-radius won't be added.
* https://github.com/ai/browserslist#queries
*/
browsers: 'last 2 versions'
})
]
};
Binary file added src/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('normalize.css/normalize.css');
require('./styles/index.scss');
8 changes: 8 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
html, body {
height: 100%;
width: 100%;
font-size: 100%;
text-align: center;
font-weight: lighter;
}

74 changes: 74 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
devtool: 'eval-cheap-module-source-map',
entry: './src/index.js',
devServer: {
port: 8080,
contentBase: path.join(__dirname, "dist")
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['env']
}
},
{
test: /\.(scss|css|sass)$/,
use: [
{
// creates style nodes from JS strings
loader: "style-loader",
options: {
sourceMap: true
}
},
{
// translates CSS into CommonJS
loader: "css-loader",
options: {
sourceMap: true
}
},
{
// compiles Sass to CSS
loader: "sass-loader",
options: {
outputStyle: 'expanded',
sourceMap: true,
sourceMapContents: true
}
}
// Please note we are not running postcss here
]
}
,
{
// Load all images as base64 encoding if they are smaller than 8192 bytes
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
// On development we want to see where the file is coming from, hence we preserve the [path]
name: '[path][name].[ext]?hash=[hash:20]',
limit: 8192
}
}
]
}
],
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: true
})
]
};
127 changes: 127 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
const path = require('path');

const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin'); //installed via npm
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');

const buildPath = path.resolve(__dirname, 'dist');

module.exports = {
devtool: 'source-map',
entry: './src/index.js',
output: {
filename: '[name].[hash:20].js',
path: buildPath
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',

options: {
presets: ['env']
}
},
{
test: /\.(scss|css|sass)$/,
use: ExtractTextPlugin.extract({
use: [
{
// translates CSS into CommonJS
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
// Runs compiled CSS through postcss for vendor prefixing
loader: 'postcss-loader',
options: {
sourceMap: true
}
},
{
// compiles Sass to CSS
loader: 'sass-loader',
options: {
outputStyle: 'expanded',
sourceMap: true,
sourceMapContents: true
}
}
],
fallback: 'style-loader'
}),
},
{
// Load all images as base64 encoding if they are smaller than 8192 bytes
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
name: '[name].[hash:20].[ext]',
limit: 8192
}
}
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
// Inject the js bundle at the end of the body of the given template
inject: 'body',
}),
new CleanWebpackPlugin(buildPath),
new FaviconsWebpackPlugin({
// Your source logo
logo: './src/assets/icon.png',
// The prefix for all image files (might be a folder or a name)
prefix: 'icons-[hash]/',
// Generate a cache file with control hashes and
// don't rebuild the favicons until those hashes change
persistentCache: true,
// Inject the html into the html-webpack-plugin
inject: true,
// favicon background color (see https://github.com/haydenbleasel/favicons#usage)
background: '#fff',
// favicon app title (see https://github.com/haydenbleasel/favicons#usage)
title: 'Open Book',

// which icons should be generated (see https://github.com/haydenbleasel/favicons#usage)
icons: {
android: true,
appleIcon: true,
appleStartup: true,
coast: false,
favicons: true,
firefox: true,
opengraph: false,
twitter: false,
yandex: false,
windows: false
}
}),
new ExtractTextPlugin('styles.[md5:contenthash:hex:20].css', {
allChunks: true
}),
new OptimizeCssAssetsPlugin({
cssProcessor: require('cssnano'),
cssProcessorOptions: {
map: {
inline: false,
},
discardComments: {
removeAll: true
}
},
canPrint: true
})
]
};

0 comments on commit bbc645c

Please sign in to comment.