Skip to content

Commit 8c2613c

Browse files
author
savoygu
committed
first commit
0 parents commit 8c2613c

24 files changed

+1273
-0
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
["env", { "modules": false }]
4+
]
5+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
node_modules
3+
.idea

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# grid
2+
3+
> Based-vue grid system component
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
npm install
10+
11+
# serve with hot reload at localhost:8080
12+
npm run demo:dev
13+
14+
# build for demo with minification
15+
npm run demo:build
16+
17+
# build for gh-pages with minification
18+
npm run demo:prepublish
19+
20+
# build for production with minification
21+
npm run build
22+
```

build/gh-pages.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
git subtree push --prefix=../gh-pages origin gh-pages

build/webpack.config.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
var path = require('path')
2+
var webpack = require('webpack')
3+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
4+
5+
module.exports = {
6+
entry: './src/index.js',
7+
output: {
8+
path: path.resolve(__dirname, '..', './lib'),
9+
filename: 'grid.js',
10+
library: 'grid',
11+
libraryTarget: 'umd'
12+
},
13+
externals: {
14+
vue: {
15+
root: 'Vue',
16+
commonjs: 'vue',
17+
commonjs2: 'vue',
18+
amd: 'vue'
19+
}
20+
},
21+
module: {
22+
rules: [
23+
{
24+
test: /\.vue$/,
25+
loader: 'vue-loader',
26+
options: {
27+
loaders: {
28+
css: ExtractTextPlugin.extract({
29+
use: 'css-loader',
30+
fallback: 'vue-style-loader'
31+
})
32+
}
33+
// other vue-loader options go here
34+
}
35+
},
36+
{
37+
test: /\.css$/,
38+
loader: ExtractTextPlugin.extract({
39+
use: "css-loader",
40+
fallback: "style-loader"
41+
})
42+
},
43+
{
44+
test: /\.js$/,
45+
loader: 'babel-loader',
46+
exclude: /node_modules/
47+
},
48+
{
49+
test: /\.(png|jpg|gif|svg)$/,
50+
loader: 'file-loader',
51+
options: {
52+
name: '[name].[ext]?[hash]'
53+
}
54+
}
55+
]
56+
},
57+
resolve: {
58+
extensions: ['.js', '.vue', '.json']
59+
},
60+
plugins: [
61+
new webpack.optimize.UglifyJsPlugin({
62+
sourceMap: true,
63+
compress: {
64+
warnings: false
65+
}
66+
}),
67+
new ExtractTextPlugin({
68+
filename: '../lib/grid.css',
69+
allChunks: true
70+
})
71+
]
72+
}

build/webpack.example.base.conf.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
var path = require('path')
2+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
3+
var isProduction = process.env.NODE_ENV === 'production'
4+
5+
module.exports = {
6+
entry: {
7+
app: './example/src/main.js'
8+
},
9+
output: {
10+
path: '/example',
11+
filename: '[name].js',
12+
publicPath: '/'
13+
},
14+
module: {
15+
rules: [
16+
{
17+
test: /\.vue$/,
18+
loader: 'vue-loader',
19+
options: {
20+
// other vue-loader options go here
21+
loaders: {
22+
css: isProduction ? ExtractTextPlugin.extract({
23+
use: 'css-loader',
24+
fallback: 'vue-style-loader'
25+
}) : 'vue-style-loader!css-loader'
26+
}
27+
}
28+
},
29+
{
30+
test: /\.js$/,
31+
loader: 'babel-loader',
32+
exclude: /node_modules/
33+
},
34+
{
35+
test: /\.(png|jpg|gif|svg)$/,
36+
loader: 'file-loader',
37+
options: {
38+
name: '[name].[ext]?[hash]'
39+
}
40+
},
41+
{
42+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
43+
loader: 'url-loader',
44+
query: {
45+
limit: 10000,
46+
name: path.posix.join('static', 'fonts/[name].[hash:7].[ext]')
47+
}
48+
}
49+
]
50+
}
51+
}

build/webpack.example.dev.conf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var webpack = require('webpack')
2+
var merge = require('webpack-merge')
3+
var baseWebpackConfig = require('./webpack.example.base.conf')
4+
var HtmlWebpackPlugin = require('html-webpack-plugin')
5+
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
6+
7+
module.exports = merge(baseWebpackConfig, {
8+
module: {
9+
rules: [
10+
{
11+
test: /\.css$/,
12+
loader: 'vue-style-loader!css-loader'
13+
}
14+
]
15+
},
16+
// cheap-module-eval-source-map is faster for development
17+
devtool: '#cheap-module-eval-source-map',
18+
plugins: [
19+
new webpack.DefinePlugin({
20+
'process.env': {
21+
NODE_ENV: '"development"'
22+
}
23+
}),
24+
new webpack.NoEmitOnErrorsPlugin(),
25+
new HtmlWebpackPlugin({
26+
filename: 'index.html',
27+
template: 'example/index.html',
28+
inject: true
29+
}),
30+
new FriendlyErrorsPlugin()
31+
]
32+
})

build/webpack.example.prod.conf.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
var path = require('path')
2+
var webpack = require('webpack')
3+
var merge = require('webpack-merge')
4+
var baseWebpackConfig = require('./webpack.example.base.conf')
5+
var HtmlWebpackPlugin = require('html-webpack-plugin')
6+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
7+
var isProduction = process.env.NODE_ENV === 'production'
8+
9+
module.exports = merge(baseWebpackConfig, {
10+
module: {
11+
rules: [
12+
{
13+
test: /\.css$/,
14+
loader: ExtractTextPlugin.extract({
15+
use: "css-loader",
16+
fallback: "style-loader"
17+
})
18+
}
19+
]
20+
},
21+
devtool: '#source-map',
22+
output: {
23+
path: path.resolve(__dirname, '..', `${isProduction ? './example/dist' : './gh-pages'}`),
24+
publicPath: isProduction ? '/' : '/grid',
25+
filename: 'js/[name].[chunkhash].js'
26+
},
27+
plugins: [
28+
new webpack.DefinePlugin({
29+
'process.env': {
30+
NODE_ENV: '"production"'
31+
}
32+
}),
33+
new webpack.optimize.UglifyJsPlugin({
34+
sourceMap: true,
35+
compress: {
36+
warnings: false
37+
}
38+
}),
39+
new ExtractTextPlugin({
40+
filename: 'css/[name].[contenthash].css',
41+
allChunks: true
42+
}),
43+
new HtmlWebpackPlugin({
44+
filename: 'index.html',
45+
template: 'example/index.html',
46+
inject: true,
47+
minify: {
48+
removeComments: true,
49+
collapseWhitespace: true,
50+
removeAttributeQuotes: true
51+
// more options:
52+
// https://github.com/kangax/html-minifier#options-quick-reference
53+
},
54+
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
55+
chunksSortMode: 'dependency'
56+
})
57+
]
58+
})

example/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!Doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport"
6+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>grid</title>
9+
<link rel="stylesheet" href="normalize.css">
10+
<style>
11+
body {
12+
font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,\\5FAE\8F6F\96C5\9ED1,Arial,sans-serif;
13+
font-size: 12px;
14+
line-height: 1.5;
15+
margin: 0;
16+
color: #495060;
17+
background-color: #fff;
18+
-webkit-font-smoothing: antialiased;
19+
-moz-osx-font-smoothing: grayscale;
20+
}
21+
</style>
22+
</head>
23+
<body>
24+
<div id="app"></div>
25+
<!-- built files will be auto injected -->
26+
</body>
27+
</html>

0 commit comments

Comments
 (0)