merge webpack-init into master (.gitignore conflict)

This commit is contained in:
xdrm-brackets 2017-11-28 16:45:17 +01:00
commit 6da4f911ae
7 changed files with 195 additions and 11 deletions

6
.babelrc Normal file
View File

@ -0,0 +1,6 @@
{
"presets": [
["env", { "modules": false }],
"stage-3"
]
}

17
.gitignore vendored Normal file → Executable file
View File

@ -1,3 +1,16 @@
/node_modules .vscode
/.vscode .DS_Store
node_modules/
dist/
npm-debug.log
yarn-error.log
public_html/js/bundle.js
public_html/js/bundle.js*
package-lock.json
# Editor directories and files
.idea .idea
*.suo
*.ntvs*
*.njsproj
*.sln

33
package.json Executable file
View File

@ -0,0 +1,33 @@
{
"name": "ndli1718",
"description": "Nuit de l'Info projet team 'Into The While'",
"version": "1.0.0",
"author": "xdrm-brackets <doowap31@gmail.com>",
"license": "MIT",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^2.4.4"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
}
}

11
view/homepage.php → view/index.php Normal file → Executable file
View File

@ -21,18 +21,11 @@
<body> <body>
<pre><?php <div id='mainview'></div>
use \database\core\Repo;
// var_dump( Repo::request('user', 'getByMail', "lucas.mascaro@yahoo.fr") );
// var_dump( Repo::request('user', 'setPassword', 1, 'lucas-pass') );
// var_dump( Repo::request('user', 'create', 'adri', 'doowap31@gmail.com', 'adri-pass') );
// var_dump( Repo::request('user', 'checkPassword', 224, 'adri-pass') );
?></pre>
<!-- Main loop --> <!-- Main loop -->
<script type='text/javascript' src='/js/action-script.js'></script> <script type='text/javascript' src='/js/action-script.js'></script>
<script type='text/javascript' src='/js/bundle.js'></script>
</body> </body>
</html> </html>

7
view/main.js Executable file
View File

@ -0,0 +1,7 @@
import Vue from 'vue'
// import App from './vue/main.vue'
new Vue({
el: '#mainview',
render: h => h(require('./vue/main.vue'))
})

59
view/vue/main.vue Executable file
View File

@ -0,0 +1,59 @@
<template>
<div id="app">
<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<ul>
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
</ul>
<h2>Ecosystem</h2>
<ul>
<li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li>
<li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li>
<li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

73
webpack.config.js Executable file
View File

@ -0,0 +1,73 @@
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './view/main.js',
output: {
path: path.resolve(__dirname, './public_html/js'),
publicPath: '/js/',
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
}, {
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other 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.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
},
performance: {
hints: false
},
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
})
])
}