Skip to content
This repository was archived by the owner on May 14, 2023. It is now read-only.

Commit 2c45039

Browse files
committed
Merge branch 'develop'
2 parents 79d7555 + 16b0f26 commit 2c45039

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+822
-16
lines changed

. babelrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["env"],
3+
"plugins": ["transform-runtime"]
4+
}
File renamed without changes.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.idea/
22
node_modules/
3-
dist/
43
**/*.log

dist/app.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/images/logo.svg

Lines changed: 15 additions & 0 deletions
Loading

dist/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta http-equiv="x-ua-compatible" content="ie=edge">
7+
<meta name="description" content="Iranian official brand colors in one place">
8+
<title>Iranian Brand Colors - Created By Jeff Mosawy</title>
9+
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
10+
<link href="app.css?f7efa963b52533da1b1b4bd2fc3becfe" rel="stylesheet"></head>
11+
<body>
12+
<div class="wrapper" id="app"></div>
13+
<script type="text/javascript" src="manifest.ec6ec81a1eb2e9caed4b.js"></script><script type="text/javascript" src="vendor.ec6ec81a1eb2e9caed4b.js"></script><script type="text/javascript" src="main.ec6ec81a1eb2e9caed4b.js"></script></body>
14+
</html>

dist/main.ec6ec81a1eb2e9caed4b.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/manifest.ec6ec81a1eb2e9caed4b.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vendor.ec6ec81a1eb2e9caed4b.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "Iranian official brand colors in one place at http://www.brandcolors.ir",
55
"private": true,
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"lint": "eslint .",
8+
"dev": "node ./server/server.js",
9+
"build": "node ./server/build.js"
810
},
911
"repository": {
1012
"type": "git",
@@ -27,6 +29,7 @@
2729
"autoprefixer": "^6.7.7",
2830
"babel-core": "^6.24.1",
2931
"babel-loader": "^6.4.1",
32+
"babel-plugin-transform-runtime": "^6.23.0",
3033
"babel-preset-env": "^1.4.0",
3134
"browser-sync": "^2.18.8",
3235
"css-loader": "^0.28.0",
@@ -44,6 +47,7 @@
4447
"resolve-url-loader": "^2.0.2",
4548
"sass-loader": "^6.0.3",
4649
"style-loader": "^0.16.1",
50+
"uglifyjs-webpack-plugin": "^0.4.3",
4751
"url-loader": "^0.5.8",
4852
"vue-loader": "^11.3.4",
4953
"vue-template-compiler": "^2.2.6",

server/build.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
process.env.NODE_ENV = 'production';
2+
3+
const webpack = require('webpack');
4+
const webpackConfig = require('./webpack.config.prod');
5+
6+
webpack(webpackConfig, (err, stats) => {
7+
if(err || stats.hasErrors()) {
8+
console.error(stats);
9+
return 0;
10+
}
11+
12+
console.log('DONE!');
13+
});

server/webpack.config.prod.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const path = require('path');
2+
const webpackModules = require('./webpack.modules.prod');
3+
const webpackPlugins = require('./webpack.plugins.prod');
4+
5+
const config = {
6+
entry: './src/index.js',
7+
output: {
8+
filename: '[name].[hash].js',
9+
path: path.resolve(__dirname, '../dist'),
10+
},
11+
target: 'web',
12+
module: webpackModules,
13+
plugins: webpackPlugins,
14+
};
15+
16+
module.exports = config;

server/webpack.modules.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ module.exports = {
1717
},
1818
{
1919
test: /\.vue$/,
20-
exclude: [
21-
path.resolve(__dirname, '../node_modules'),
20+
exclude: /node_modules/,
21+
use: [
22+
{ loader: 'vue-loader' },
2223
],
23-
use: 'vue-loader',
2424
},
2525
{
2626
test: /\.js$/,
27-
exclude: [
28-
path.resolve(__dirname, '../node_modules'),
29-
],
27+
exclude: /node_modules/,
3028
use: [
3129
{ loader: 'babel-loader' },
3230
],

server/webpack.modules.prod.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
3+
const path = require('path');
4+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
5+
6+
module.exports = {
7+
rules: [
8+
{
9+
test: /\.(js|vue)$/,
10+
exclude: [
11+
path.resolve(__dirname, '../node_modules'),
12+
],
13+
use: [
14+
{ loader: 'eslint-loader', options: { failOnError: true } },
15+
],
16+
enforce: 'pre',
17+
},
18+
{
19+
test: /\.vue$/,
20+
exclude: [
21+
path.resolve(__dirname, '../node_modules'),
22+
],
23+
use: 'vue-loader',
24+
},
25+
{
26+
test: /\.js$/,
27+
exclude: [
28+
path.resolve(__dirname, '../node_modules'),
29+
],
30+
use: [
31+
{ loader: 'babel-loader' },
32+
],
33+
},
34+
{
35+
test: /\.scss$/,
36+
exclude: [
37+
path.resolve(__dirname, '../node_modules'),
38+
],
39+
use: ExtractTextPlugin.extract({
40+
fallback: 'style-loader',
41+
use: [
42+
{ loader: 'css-loader', options: { minimize: true } },
43+
{ loader: 'resolve-url-loader' },
44+
{ loader: 'sass-loader?sourceMap' },
45+
{ loader: 'postcss-loader' },
46+
],
47+
}),
48+
},
49+
{
50+
test: /\.(woff|woff2)$/,
51+
use: [
52+
{ loader: 'file-loader', options: { name: 'fonts/[name].[ext]' } },
53+
],
54+
},
55+
{
56+
test: /\.(gif|jpg|png)$/,
57+
use: [
58+
{ loader: 'url-loader', options: { name: 'images/[name].[ext]?[hash]', limit: 5000 } },
59+
],
60+
},
61+
{
62+
test: /\.svg$/,
63+
use: [
64+
{ loader: 'file-loader', options: { name: 'images/[name].[ext]?[hash]' } },
65+
],
66+
},
67+
],
68+
};

server/webpack.plugins.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const webpack = require('webpack');
44
const HtmlWebpackPlugin = require('html-webpack-plugin');
55
const ExtractTextPlugin = require('extract-text-webpack-plugin');
66

7-
const COPYRIGHT_TEXT = 'Copyright 2017\nCode by Jeff Mosawy\n\nhttp://www.jmosawy.com\nj@mosawy.net';
8-
97
module.exports = [
108
new webpack.optimize.CommonsChunkPlugin({
119
name: 'vendor',
@@ -23,5 +21,4 @@ module.exports = [
2321
}),
2422
new webpack.HotModuleReplacementPlugin(),
2523
new ExtractTextPlugin('app.css?[contenthash]'),
26-
new webpack.BannerPlugin({ banner: COPYRIGHT_TEXT }),
2724
];

server/webpack.plugins.prod.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
3+
const webpack = require('webpack');
4+
const HtmlWebpackPlugin = require('html-webpack-plugin');
5+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
6+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
7+
8+
const COPYRIGHT_TEXT = 'Copyright 2017\nCode by Jeff Mosawy\n\nhttp://www.jmosawy.com\nj@mosawy.net';
9+
10+
module.exports = [
11+
new webpack.optimize.CommonsChunkPlugin({
12+
name: 'vendor',
13+
minChunks(module) {
14+
return module.context && module.context.indexOf('node_modules') !== -1;
15+
},
16+
}),
17+
new webpack.optimize.CommonsChunkPlugin({
18+
name: 'manifest',
19+
}),
20+
new HtmlWebpackPlugin({
21+
filename: 'index.html',
22+
template: 'index.html',
23+
inject: true,
24+
}),
25+
new UglifyJsPlugin(),
26+
new ExtractTextPlugin('app.css?[contenthash]'),
27+
new webpack.BannerPlugin({ banner: COPYRIGHT_TEXT }),
28+
new webpack.DefinePlugin({
29+
'process.env.NODE_ENV': JSON.stringify('production')
30+
}),
31+
];

src/App.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<div class="wrapper" id="app">
3+
<bc-header></bc-header>
4+
<router-view></router-view>
5+
<bc-notification v-if="showNotification" :color="selectedColor"></bc-notification>
6+
</div>
7+
</template>
8+
9+
<script>
10+
/* eslint-disable object-shorthand */
11+
12+
import BcHeader from './components/header.vue';
13+
import BcNotification from './components/notification.vue';
14+
import EventBus from './EventBus';
15+
16+
export default {
17+
data() {
18+
return {
19+
showNotification: false,
20+
selectedColor: null,
21+
};
22+
},
23+
components: {
24+
BcHeader,
25+
BcNotification,
26+
},
27+
mounted: function () {
28+
EventBus.$on('color.copied', (color) => {
29+
this.showNotification = true;
30+
this.selectedColor = color;
31+
setTimeout(() => {
32+
this.showNotification = false;
33+
}, 1000);
34+
});
35+
},
36+
};
37+
</script>

src/EventBus.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Vue from 'vue';
2+
3+
const EventBus = new Vue();
4+
5+
export default EventBus;

0 commit comments

Comments
 (0)