Skip to content

Instantly share code, notes, and snippets.

View dushyant89's full-sized avatar
🎯
Focusing

Dushyant Sabharwal dushyant89

🎯
Focusing
View GitHub Profile
@dushyant89
dushyant89 / npm_dependency_types.md
Last active June 19, 2019 08:17
NPM Dependency types

NPM dependency types comparison

Compiled a list of differences between different types of dependencies supported by NPM. If you are someone like who doesn't change package.json often but needs something for a quick reference then the below table might be helpful.

| Dimension | Direct | Dev | Peer | Optional | Bundled | |-----------------------------|---------------------------------------|-------------------------------------------------|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------

@dushyant89
dushyant89 / Login.vue
Created November 24, 2018 15:39
Login component which replaces the About component
<template>
<div>
<h1>This is a WIP login page</h1>
</div>
</template>
@dushyant89
dushyant89 / webpackDevServer.config.js
Created June 11, 2018 11:39
webpack-dev-server config for vue webpack
devServer: {
// The url you want the webpack-dev-server to use for serving files.
host: '0.0.0.0',
// Can be the popular 8080 also.
port: 8010,
// gzip compression
compress: true,
// Open the browser window, set to false if you are in a headless browser environment.
open: false,
watchOptions: {
@dushyant89
dushyant89 / module.config.js
Last active June 11, 2018 11:38
vue webpack module config
module: {
rules: [
{
// vue-loader config to load `.vue` files or single file components.
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
// https://vue-loader.vuejs.org/guide/scoped-css.html#mixing-local-and-global-styles
css: ['vue-style-loader', {
@dushyant89
dushyant89 / config.js
Created June 11, 2018 11:36
entry and output for vue-webpack
entry: {
// Since we need to load vue in the entry page.
vue: 'vue',
// This is where the `main-content` component is
index: resolve('src/index.js'),
},
output: {
filename: '[name].js',
// Folder where the output of webpack's result go.
path: resolve('dist'),
@dushyant89
dushyant89 / main-content.vue
Last active June 11, 2018 09:46
Example single file component in vue
<template>
<div class="main-content">
<h1> This is your first component in Vue </h1>
<h3> {{ webpack }} </h3>
</div>
</template>
<script>
export default {
name: "main-content",
@dushyant89
dushyant89 / webpack.config.js
Created June 11, 2018 09:15
Webpack config for vue single file components
const path = require('path');
const webpack = require('webpack');
// `..` since this config file is in the config folder.
const resolve = relativePath => path.resolve(__dirname, '..', relativePath);
module.exports = {
mode: 'development',
entry: {
// since we need to load view in the entry page.
vue: 'vue',
@dushyant89
dushyant89 / package.json
Created June 11, 2018 08:59
Dependencies in package.json for vue single file components
"dependencies": {
"vue": "^2.5.16"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.24.1",
"css-loader": "^0.28.11",
"vue-loader": "^14.2.2",
@dushyant89
dushyant89 / package.json
Created June 11, 2018 08:00
Dependencies in package.json for vue and webpack
{
"dependencies": {
"vue": "^2.5.16"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.24.1",
"webpack": "^4.11.1",
@dushyant89
dushyant89 / index.html
Last active June 7, 2018 15:51
Loading vue from script includes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue Webpack Demo</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
</head>
<body>
<div id="mainContent">
{{ message }}