Coder Social home page Coder Social logo

fast's Introduction

Laravel 5.7 scaffold with vue.js + tailwind preset + turbolinks

By cloning this repo and running npm install you get a fast folder containing a new Laravel 5.7 app with vue.js, auth and tailwind presets and turbolinks.

โš ๏ธ If you clone this repo in a folder with a different name you need to fix the browserSync proxy defined in the webpack.mix.js file.

  • Clone the repo git clone [email protected]:ssomenzi/fast.git

  • cd in the fast directory cd fast

  • Run composer install.

  • Create your .env file duplicating the .env.example file cp .env.example .env.

  • Set your db credentials in the .env file.

  • Run php artisan key:generate

  • Run php artisan migrate.

  • Run npm install

  • Run npm run watch and you're ready to go... and to go pretty fast.

What this repo does

Gives you a Laravel 5.7 app with auth.

Installs the laravel-frontend-presets/tailwindcss npm package

Installs the turbolinks npm package and adds

	import Turbolinks from 'turbolinks'
	Turbolinks.start()

to your resources/js/app.js file.

Installs the vue-turbolinks npm package and adds

	import TurbolinksAdapter from 'vue-turbolinks'
	Vue.use(TurbolinksAdapter)

to your resources/js/app.js file.

In your resources/js/app.js file, wraps your vue.js instance creation in a listener to fix lifecycle conflicts between vue and turbolinks

	document.addEventListener('turbolinks:load', () => {
	    let app = new Vue({
	        el: '#app'
	    })
	})

In your webpack.mix.js file, adds an option to the browserSync configuration object to insert the turbolinks js snippet in the <head> section of your page so it is not added on each page load

	snippetOptions: {
		rule: {
			match: /<\/head>/i,
			fn: function (snippet, match) {
				return snippet + match;
			}
		}
	}

Changes the home view and adds an about view with some tailwind magic with their links in the navigation bar and the related routes in the routes/web.php file, just to show that turbolinks is working fine.

fast's People

Contributors

ssomenzi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.