Last active
February 9, 2021 15:45
-
-
Save bstavroulakis/dcaf903e3f8d3bf6e6fa202b34c3849a to your computer and use it in GitHub Desktop.
PS Vue-spa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install eslint@4.5.0 eslint-loader@1.9.0 eslint-plugin-html@3.2.0 eslint-config-standard@10.2.1 eslint-plugin-promise@3.5.0 eslint-plugin-standard@3.0.1 eslint-plugin-import@2.7.0 eslint-plugin-node@5.1.1 --save-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
root: true, | |
parserOptions: { | |
sourceType: "module" | |
}, | |
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style | |
extends: "standard", | |
// required to lint *.vue files | |
plugins: ["html"] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.component('app', { | |
template: ` | |
<div id="app"> | |
<nav class="nav has-shadow"> | |
<div class="container"> | |
<a href="/"> | |
<img src="http://bit.ly/vue-img" | |
alt="Vue SPA" /> | |
</a> | |
</div> | |
</nav> | |
<section class="main-section section"></section> | |
<footer class="footer"> | |
<div class="container"> | |
<div class="content has-text-centered"> | |
Follow us on | |
<a href="https://twitter.com/bstavroulakis" | |
target="_blank">Twitter</a> | |
</div> | |
</div> | |
</footer> | |
</div> | |
` | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install babel-core@6.26.0 babel-eslint@7.2.3 babel-loader@7.1.2 babel-preset-es2015@6.24.1 babel-preset-stage-2@6.24.1 --save-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data() { | |
return { | |
posts: [ | |
{ id: 1, title: 'PWA Stats', content: 'A community-driven list of stats and news related to Progressive Web Apps', link: 'https://www.pwastats.com/' }, | |
{ id: 2, title: 'A Comprehensive Guide To HTTP/2 Server Push', content: 'No longer is HTTP/2 a feature we pine for. It has arrived, and with it comes server push!', link: 'https://www.smashingmagazine.com/2017/04/guide-http2-server-push/' }, | |
{ id: 3, title: 'So what’s this GraphQL thing I keep hearing about?', content: 'Why now is the perfect time to learn what exactly this GraphQL thing you keep hearing about really is.', link: 'https://medium.freecodecamp.com/so-whats-this-graphql-thing-i-keep-hearing-about-baf4d36c20cf' }, | |
{ id: 4, title: 'State of The Mobile Gap Between Native and Web', content: 'Clearly PhoneGap, and Cordova are still required today in the mobile world, but when is it really needed? Did the web ever catch up?', link: 'https://remysharp.com/2016/05/28/state-of-the-gap' }, | |
{ id: 5, title: 'Learning JavaScript Design Patterns', content: 'Design patterns are reusable solutions to commonly occurring problems in software design.', link: 'https://addyosmani.com/resources/essentialjsdesignpatterns/book/' }, | |
{ id: 6, title: 'The Power of Custom Directives in Vue', content: 'The beautiful thing about Vue is that it\'s incredibly feature-rich.', link: 'https://css-tricks.com/power-custom-directives-vue/' } | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container content"> | |
<div class="columns"> | |
<div class="column is-one-third" v-for="(post, title) in posts" v-bind:key="post.id"> | |
<div class="card"> | |
<div class="card-content"> | |
<h3>{{ post.title }}</h3> | |
{{ post.content }} | |
</div> | |
<footer class="card-footer"> | |
<a class="card-footer-item" :href="post.link" target="_blank">Read More</a> | |
</footer> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.card{ | |
padding-bottom: 40px; | |
height:100%; | |
} | |
footer{ | |
position: absolute; | |
bottom: 0; | |
width: 100%; | |
left: 0; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="content"> | |
<h2>Login</h2> | |
<div class="field is-horizontal"> | |
<div class="field-label is-normal"> | |
<label class="label">Username</label> | |
</div> | |
<div class="field-body"> | |
<div class="field"> | |
<div class="control"> | |
<input class="input" type="text" | |
placeholder="Your username"> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="field is-horizontal"> | |
<div class="field-label is-normal"> | |
<label class="label">Password</label> | |
</div> | |
<div class="field-body"> | |
<div class="field"> | |
<div class="control"> | |
<input class="input" type="password" | |
placeholder="Your password"> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="field is-horizontal"> | |
<div class="field-label"> | |
<!-- Left empty for spacing --> | |
</div> | |
<div class="field-body"> | |
<div class="field"> | |
<div class="control"> | |
<button class="button is-primary"> | |
Login | |
</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const webpack = require('webpack') | |
const base = require('./webpack.base.config') | |
const nodeExternals = require('webpack-node-externals') | |
const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
const config = Object.assign({}, base, { | |
entry: path.resolve(__dirname, '../src/server-entry.js'), | |
target: 'node', | |
devtool: 'source-map', | |
output: { | |
path: path.resolve(__dirname, '../dist'), | |
filename: 'server/[name].js', | |
libraryTarget: 'commonjs2' | |
}, | |
externals: nodeExternals({ | |
whitelist: /\.css$/ | |
}), | |
plugins: [ | |
new ExtractTextPlugin('server/styles.css') | |
] | |
}) | |
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save-dev chai@4.1.2 cross-env@5.0.5 karma@1.7.1 mocha@3.5.3 karma-mocha@1.3.0 karma-phantomjs-launcher@1.0.4 karma-webpack@2.0.4 karma-sinon-chai@1.3.2 sinon@4.0.0 sinon-chai@2.14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpackConfig = require('../../build/webpack.test.config.js') | |
module.exports = function (config) { | |
config.set({ | |
browsers: ['PhantomJS'], | |
frameworks: ['mocha', 'sinon-chai'], | |
files: ['./index.js'], | |
preprocessors: { | |
'./index.js': ['webpack'] | |
}, | |
plugins: [ | |
'karma-mocha', | |
'karma-sinon-chai', | |
'karma-phantomjs-launcher', | |
'karma-webpack' | |
], | |
webpack: webpackConfig, | |
webpackMiddleware: { | |
noInfo: true | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment