Skip to content

Instantly share code, notes, and snippets.

@ppscvalentin
Last active January 2, 2019 13:10
Show Gist options
  • Save ppscvalentin/95cc1736270b93034fd3a07858cf6f5e to your computer and use it in GitHub Desktop.
Save ppscvalentin/95cc1736270b93034fd3a07858cf6f5e to your computer and use it in GitHub Desktop.
nuxt.js config for static website
# Created by https://www.gitignore.io/api/vue,node,nuxt,macos,visualstudiocode
# Edit at https://www.gitignore.io/?templates=vue,node,nuxt,macos,visualstudiocode
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
### Nuxt ###
# gitignore template for Nuxt.js projects
#
# Recommended template: Node.gitignore
# Nuxt build
# Nuxt generate
dist
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
### Vue ###
# gitignore template for Vue.js projects
#
# Recommended template: Node.gitignore
# TODO: where does this rule come from?
docs/_book
# TODO: where does this rule come from?
test/
# End of https://www.gitignore.io/api/vue,node,nuxt,macos,visualstudiocode
# init
vue init nuxt-community/starter-template
# install packages
npm install
# edit .gitignore
# install additional packages
# push-dir so you can push just dist/ to branch gh-pages
npm install push-dir --save-dev
# sass
npm install node-sass sass-loader --save-dev
// gh-pages
// only add `router.base = '/<repository-name>/'` if `DEPLOY_ENV` is `GH_PAGES`
// and include it in module.exports
const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
router: {
base: '<repository-name>'
}
} : {}
module.exports = {
// .. //
// include a global css file
// if .scss it first becomes .css then is included in all pages
css: [
'@/assets/scss/main.scss'
],
/* .. */
...routerBase
}
// add these very usefull scripts to package.json
{
"scripts": {
"build:gh-pages": "DEPLOY_ENV=GH_PAGES nuxt build",
"generate:gh-pages": "DEPLOY_ENV=GH_PAGES nuxt generate",
"deploy": "npx push-dir --dir=dist --branch=gh-pages --cleanup"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment