Skip to content

Commit

Permalink
Add components
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Luíz committed Dec 20, 2016
1 parent ae97078 commit 67215b9
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 0 deletions.
5 changes: 5 additions & 0 deletions componentes/.babelrc
@@ -0,0 +1,5 @@
{
"presets": [
["es2015", { "modules": false }]
]
}
4 changes: 4 additions & 0 deletions componentes/.gitignore
@@ -0,0 +1,4 @@
.DS_Store
node_modules/
dist/
npm-debug.log
18 changes: 18 additions & 0 deletions componentes/README.md
@@ -0,0 +1,18 @@
# componentes

> A Vue.js project
## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build
```

For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
11 changes: 11 additions & 0 deletions componentes/index.html
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>componentes</title>
</head>
<body>
<div id="app"></div>
<script src="/dist/build.js"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions componentes/package.json
@@ -0,0 +1,26 @@
{
"name": "componentes",
"description": "A Vue.js project",
"version": "1.0.0",
"author": "",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^2.1.0"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^10.0.0",
"vue-template-compiler": "^2.1.0",
"webpack": "^2.1.0-beta.25",
"webpack-dev-server": "^2.1.0-beta.0"
}
}
22 changes: 22 additions & 0 deletions componentes/src/App.vue
@@ -0,0 +1,22 @@
<template>
<div id="app">
<Header />
<Article />
</div>
</template>

<script>
import Header from './components/header/header.vue'
import Article from './components/article/article.vue'
export default {
name: 'app',
components: {
Header,
Article
},
data () {
return {}
}
}
</script>
Binary file added componentes/src/assets/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions componentes/src/components/article/article.vue
@@ -0,0 +1,17 @@
<template lang="html">
<article class="">
<h2>Hello from article!</h2>
<ArticleForm />
</article>
</template>

<script>
import ArticleForm from './articleForm.vue'
export default {
components: { ArticleForm }
}
</script>

<style lang="css">
</style>
13 changes: 13 additions & 0 deletions componentes/src/components/article/articleForm.vue
@@ -0,0 +1,13 @@
<template lang="html">
<form>
<input type="text" name="" value="">
</form>
</template>

<script>
export default {
}
</script>

<style lang="css">
</style>
13 changes: 13 additions & 0 deletions componentes/src/components/header/header.vue
@@ -0,0 +1,13 @@
<template lang="html">
<header>
<h1>Hello from header!</h1>
</header>
</template>

<script>
export default {
}
</script>

<style lang="css">
</style>
7 changes: 7 additions & 0 deletions componentes/src/main.js
@@ -0,0 +1,7 @@
import Vue from 'vue'
import App from './App.vue'

new Vue({
el: '#app',
render: h => h(App)
})
65 changes: 65 additions & 0 deletions componentes/webpack.config.js
@@ -0,0 +1,65 @@
var path = require('path')
var webpack = require('webpack')

module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
// vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
devtool: '#eval-source-map'
}

if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}

0 comments on commit 67215b9

Please sign in to comment.