From 6d059698a963e5a11ddfe4b23366749ff9676cb0 Mon Sep 17 00:00:00 2001 From: chiboreache Date: Tue, 19 Feb 2019 19:07:04 +0300 Subject: [PATCH] chore: add pug-stylus-coffee (#4927) * add pug-stylus-coffee * fix eslit * fix eslint * fix eslint #3 --- .eslintignore | 2 +- examples/pug-stylus-coffee/README.md | 20 ++++++ .../pug-stylus-coffee/components/Logo.vue | 66 ++++++++++++++++++ .../pug-stylus-coffee/components/README.md | 7 ++ examples/pug-stylus-coffee/layouts/README.md | 7 ++ .../pug-stylus-coffee/layouts/default.vue | 46 ++++++++++++ .../pug-stylus-coffee/middleware/README.md | 8 +++ .../pug-stylus-coffee/modules/coffeescript.js | 17 +++++ examples/pug-stylus-coffee/nuxt.config.coffee | 48 +++++++++++++ examples/pug-stylus-coffee/nuxt.config.js | 2 + examples/pug-stylus-coffee/package.json | 25 +++++++ examples/pug-stylus-coffee/pages/README.md | 7 ++ examples/pug-stylus-coffee/pages/index.vue | 55 +++++++++++++++ examples/pug-stylus-coffee/plugins/README.md | 7 ++ examples/pug-stylus-coffee/static/README.md | 10 +++ examples/pug-stylus-coffee/static/favicon.ico | Bin 0 -> 1150 bytes examples/pug-stylus-coffee/store/README.md | 10 +++ examples/pug-stylus-coffee/store/index.coffee | 3 + 18 files changed, 339 insertions(+), 1 deletion(-) create mode 100644 examples/pug-stylus-coffee/README.md create mode 100644 examples/pug-stylus-coffee/components/Logo.vue create mode 100644 examples/pug-stylus-coffee/components/README.md create mode 100644 examples/pug-stylus-coffee/layouts/README.md create mode 100644 examples/pug-stylus-coffee/layouts/default.vue create mode 100644 examples/pug-stylus-coffee/middleware/README.md create mode 100644 examples/pug-stylus-coffee/modules/coffeescript.js create mode 100644 examples/pug-stylus-coffee/nuxt.config.coffee create mode 100644 examples/pug-stylus-coffee/nuxt.config.js create mode 100644 examples/pug-stylus-coffee/package.json create mode 100644 examples/pug-stylus-coffee/pages/README.md create mode 100644 examples/pug-stylus-coffee/pages/index.vue create mode 100644 examples/pug-stylus-coffee/plugins/README.md create mode 100644 examples/pug-stylus-coffee/static/README.md create mode 100644 examples/pug-stylus-coffee/static/favicon.ico create mode 100644 examples/pug-stylus-coffee/store/README.md create mode 100644 examples/pug-stylus-coffee/store/index.coffee diff --git a/.eslintignore b/.eslintignore index 48de14efb0..8e3846f0c8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,7 +8,7 @@ coverage ## cofeescript examples/coffeescript/pages/index.vue - +examples/pug-stylus-coffee/ # Packages # vue-app diff --git a/examples/pug-stylus-coffee/README.md b/examples/pug-stylus-coffee/README.md new file mode 100644 index 0000000000..930f5e4d87 --- /dev/null +++ b/examples/pug-stylus-coffee/README.md @@ -0,0 +1,20 @@ +# Pug + Stylus + Coffee template for Nuxt.js + +> Ultimative complete pack for coding with pleasure and Nuxt.js + +## Build Setup + +``` bash +# install dependencies +$ npm install + +# serve with hot reload at localhost:3000 +$ npm run dev + +# build for production and launch server +$ npm run build +$ npm start + +# generate static project +$ npm run generate +``` diff --git a/examples/pug-stylus-coffee/components/Logo.vue b/examples/pug-stylus-coffee/components/Logo.vue new file mode 100644 index 0000000000..14799f76d3 --- /dev/null +++ b/examples/pug-stylus-coffee/components/Logo.vue @@ -0,0 +1,66 @@ + + + diff --git a/examples/pug-stylus-coffee/components/README.md b/examples/pug-stylus-coffee/components/README.md new file mode 100644 index 0000000000..a079f1060e --- /dev/null +++ b/examples/pug-stylus-coffee/components/README.md @@ -0,0 +1,7 @@ +# COMPONENTS + +**This directory is not required, you can delete it if you don't want to use it.** + +The components directory contains your Vue.js Components. + +_Nuxt.js doesn't supercharge these components._ diff --git a/examples/pug-stylus-coffee/layouts/README.md b/examples/pug-stylus-coffee/layouts/README.md new file mode 100644 index 0000000000..cad1ad5738 --- /dev/null +++ b/examples/pug-stylus-coffee/layouts/README.md @@ -0,0 +1,7 @@ +# LAYOUTS + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your Application Layouts. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). diff --git a/examples/pug-stylus-coffee/layouts/default.vue b/examples/pug-stylus-coffee/layouts/default.vue new file mode 100644 index 0000000000..540fff86da --- /dev/null +++ b/examples/pug-stylus-coffee/layouts/default.vue @@ -0,0 +1,46 @@ + + + diff --git a/examples/pug-stylus-coffee/middleware/README.md b/examples/pug-stylus-coffee/middleware/README.md new file mode 100644 index 0000000000..01595ded74 --- /dev/null +++ b/examples/pug-stylus-coffee/middleware/README.md @@ -0,0 +1,8 @@ +# MIDDLEWARE + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your application middleware. +Middleware let you define custom functions that can be run before rendering either a page or a group of pages. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). diff --git a/examples/pug-stylus-coffee/modules/coffeescript.js b/examples/pug-stylus-coffee/modules/coffeescript.js new file mode 100644 index 0000000000..b8ccfc05d5 --- /dev/null +++ b/examples/pug-stylus-coffee/modules/coffeescript.js @@ -0,0 +1,17 @@ +export default function () { + // Add .coffee extension for store, middleware and more + this.nuxt.options.extensions.push('coffee') + // Extend build + const coffeeLoader = { + test: /\.coffee$/, + loader: 'coffee-loader' + } + this.extendBuild((config) => { + // Add CoffeeScruot loader + config.module.rules.push(coffeeLoader) + // Add .coffee extension in webpack resolve + if (config.resolve.extensions.indexOf('.coffee') === -1) { + config.resolve.extensions.push('.coffee') + } + }) +} diff --git a/examples/pug-stylus-coffee/nuxt.config.coffee b/examples/pug-stylus-coffee/nuxt.config.coffee new file mode 100644 index 0000000000..039a2022ba --- /dev/null +++ b/examples/pug-stylus-coffee/nuxt.config.coffee @@ -0,0 +1,48 @@ +pkg = require('./package') +module.exports = + mode: 'universal' + # + # Headers of the page + # + head: + title: pkg.name + meta: + [ + { + charset: 'utf-8' + } + { + name: 'viewport' + content: 'width=device-width, initial-scale=1' + } + { + hid: 'description' + name: 'description' + content: pkg.description + } + ] + link: + [ + rel: 'icon' + type: 'image/x-icon' + href: '/favicon.ico' + ] + # Customize the progress-bar color + loading: + { + color: '#3B8070' + } + # Global CSS + css: [] + # Plugins to load before mounting the App + plugins: [] + # Nuxt.js modules + modules: + [ + '~/modules/coffeescript' + ] + # Build configuration + build: + # You can extend webpack config here + extend = (config, ctx) -> + pass diff --git a/examples/pug-stylus-coffee/nuxt.config.js b/examples/pug-stylus-coffee/nuxt.config.js new file mode 100644 index 0000000000..3d783db4d2 --- /dev/null +++ b/examples/pug-stylus-coffee/nuxt.config.js @@ -0,0 +1,2 @@ +require('coffeescript/register') +module.exports = require('./nuxt.config.coffee') diff --git a/examples/pug-stylus-coffee/package.json b/examples/pug-stylus-coffee/package.json new file mode 100644 index 0000000000..c63df436f8 --- /dev/null +++ b/examples/pug-stylus-coffee/package.json @@ -0,0 +1,25 @@ +{ + "name": "example-pug-stylus-coffee", + "version": "1.0.0", + "description": "Nuxt.js with Pug Stylus and CoffeeScript", + "author": "Alex Ananiev , Kron Austrum ", + "private": true, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start", + "generate": "nuxt generate", + "post-update": "yarn upgrade --latest" + }, + "dependencies": { + "nuxt": "latest" + }, + "devDependencies": { + "coffee-loader": "^0.8.0", + "coffeescript": "^2.0.1", + "pug": "^2.0.3", + "pug-plain-loader": "^1.0.0", + "stylus": "^0.54.5", + "stylus-loader": "^3.0.2" + } +} diff --git a/examples/pug-stylus-coffee/pages/README.md b/examples/pug-stylus-coffee/pages/README.md new file mode 100644 index 0000000000..3c7faf56e7 --- /dev/null +++ b/examples/pug-stylus-coffee/pages/README.md @@ -0,0 +1,7 @@ +# PAGES + +This directory contains your Application Views and Routes. +The framework reads all the .vue files inside this directory and create the router of your application. + +More information about the usage of this directory in the documentation: +https://nuxtjs.org/guide/routing diff --git a/examples/pug-stylus-coffee/pages/index.vue b/examples/pug-stylus-coffee/pages/index.vue new file mode 100644 index 0000000000..ee0df7e4ef --- /dev/null +++ b/examples/pug-stylus-coffee/pages/index.vue @@ -0,0 +1,55 @@ + + + + + + diff --git a/examples/pug-stylus-coffee/plugins/README.md b/examples/pug-stylus-coffee/plugins/README.md new file mode 100644 index 0000000000..ca1f9d8a45 --- /dev/null +++ b/examples/pug-stylus-coffee/plugins/README.md @@ -0,0 +1,7 @@ +# PLUGINS + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). diff --git a/examples/pug-stylus-coffee/static/README.md b/examples/pug-stylus-coffee/static/README.md new file mode 100644 index 0000000000..3fc5002348 --- /dev/null +++ b/examples/pug-stylus-coffee/static/README.md @@ -0,0 +1,10 @@ +# STATIC + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your static files. +Each file inside this directory is mapped to `/`. + +Example: `/static/robots.txt` is mapped as `/robots.txt`. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). diff --git a/examples/pug-stylus-coffee/static/favicon.ico b/examples/pug-stylus-coffee/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..c785410aa253440c16be3c4153584815449ef1fb GIT binary patch literal 1150 zcmd5(Pe>GD6#uQ8iV-=ZwUidsK@&EZ(IrAUb&A%lU$(#ZYJdD~UWj;l`Rd^{nh zvPGN}$SeeV;!$laVfJ1~#PqIOBnSGsnRD^RQ246jwOzD5wPM z_SD~bg#W3J7S6Crgk`)H)%qE~bp3LFqp)$Nv3OK}@i2R&k#jE+y)stFToFU;zualj9wjApeo{)sviIhPWwxnYrM*(FYyh9q!t3 zl`rgJpY+v}lLegM9BY#$?B|=B)ZeFFb&z#8IeW4mXS + msg: 'Hello from /store/index.coffee!' + msgComputed: 'Hello from /store/index.coffee computed!'