-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aeacdd9
Showing
14 changed files
with
348 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.DS_Store | ||
.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Use this repo as a skeleton for your new preset, once you're done please open an issue on [this repo](https://github.com/laravel-frontend-presets/internals). | ||
|
||
Here's the latest documentation on Laravel 5.5: | ||
|
||
https://laravel.com/docs/master/ | ||
|
||
# A Boilerplate repo for presets | ||
|
||
This package makes it easy to use [:preset-name](:link-to-website) with Laravel 5.5+. | ||
|
||
**Note:** Replace ```:preset-name```, ```:link-to-website```, ```:author-name``` and ```:author-username``` on this file, and then delete this line. | ||
|
||
**Note:** Make sure you replace all the instances of the word ```skeleton``` or ```Skeleton``` on this file, the `composer.json` file and on the `src/` folder, and to rename the files. You can delete this line after. | ||
|
||
This is where your description should go. Add a little code example so build can understand real quick how the package can be used. Try and limit it to a paragraph or two. | ||
|
||
|
||
|
||
## Contents | ||
|
||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Contributing](#contributing) | ||
- [Credits](#credits) | ||
- [License](#license) | ||
|
||
|
||
## Installation | ||
|
||
To install this preset on your laravel application, simply run: | ||
|
||
``` bash | ||
composer require laravel-frontend-presets/skeleton | ||
``` | ||
|
||
## Contributing | ||
|
||
Please check our contributing rules in [our website](https://laravel-frontend-presets.github.io) for details. | ||
|
||
## Credits | ||
|
||
- [:author_name](https://github.com/:author_username) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "laravel-frontend-presets/vuetify", | ||
"description": "Laravel 5.5+ Front-end preset for vuetify", | ||
"keywords": ["laravel", "preset", "vuetify"], | ||
"license": "MIT", | ||
"require": { | ||
"laravel/framework": "5.5.*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"LaravelFrontendPresets\\Vuetify\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"LaravelFrontendPresets\\Vuetify\\VuetifyPresetServiceProvider" | ||
] | ||
} | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
|
||
namespace LaravelFrontendPresets\SkeletonPreset; | ||
|
||
use Artisan; | ||
use Illuminate\Support\Arr; | ||
use Illuminate\Filesystem\Filesystem; | ||
use Illuminate\Foundation\Console\Presets\Preset; | ||
|
||
/** | ||
* Class VuetifyPreset. | ||
* | ||
* @package LaravelFrontendPresets\SkeletonPreset | ||
*/ | ||
class VuetifyPreset extends Preset | ||
{ | ||
/** | ||
* Install the preset. | ||
* | ||
* @return void | ||
*/ | ||
public static function install($withAuth = false) | ||
{ | ||
static::updatePackages(); | ||
static::removeSass(); // or static::updateLess() | ||
static::updateBootstrapping(); | ||
|
||
if($withAuth) | ||
{ | ||
static::addAuthTemplates(); // optional | ||
} | ||
else | ||
{ | ||
static::updateWelcomePage(); //optional | ||
} | ||
|
||
static::removeNodeModules(); | ||
} | ||
|
||
/** | ||
* Update the given package array. | ||
* | ||
* @param array $packages | ||
* @return array | ||
*/ | ||
protected static function updatePackageArray(array $packages) | ||
{ | ||
// packages to add to the package.json | ||
$packagesToAdd = ['package-name' => '^version']; | ||
// packages to remove from the package.json | ||
$packagesToRemove = ['package-name' => '^version']; | ||
return $packagesToAdd + Arr::except($packages, $packagesToRemove); | ||
} | ||
|
||
/** | ||
* Update the Sass files for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected static function removeSass() | ||
{ | ||
// clean up all the files in the sass folder | ||
$orphan_sass_files = glob(resource_path('/assets/sass/*.*')); | ||
|
||
foreach($orphan_sass_files as $sass_file) | ||
{ | ||
(new Filesystem)->delete($sass_file); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Update the bootstrapping files. | ||
* | ||
* @return void | ||
*/ | ||
protected static function updateBootstrapping() | ||
{ | ||
// remove exisiting bootstrap.js file | ||
(new Filesystem)->delete( | ||
resource_path('assets/js/bootstrap.js') | ||
); | ||
|
||
// copy a new bootstrap.js file from your stubs folder | ||
copy(__DIR__.'/skeleton-stubs/bootstrap.js', resource_path('assets/js/bootstrap.js')); | ||
} | ||
|
||
/** | ||
* Update the default welcome page file. | ||
* | ||
* @return void | ||
*/ | ||
protected static function updateWelcomePage() | ||
{ | ||
// remove default welcome page | ||
(new Filesystem)->delete( | ||
resource_path('views/welcome.blade.php') | ||
); | ||
|
||
// copy new one from your stubs folder | ||
copy(__DIR__.'/skeleton-stubs/views/welcome.blade.php', resource_path('views/welcome.blade.php')); | ||
} | ||
|
||
/** | ||
* Copy Auth view templates. | ||
* | ||
* @return void | ||
*/ | ||
protected static function addAuthTemplates() | ||
{ | ||
// Add Home controller | ||
copy(__DIR__.'/stubs-stubs/Controllers/HomeController.php', app_path('Http/Controllers/HomeController.php')); | ||
|
||
// Add Auth routes in 'routes/web.php' | ||
$auth_route_entry = "Auth::routes();\n\nRoute::get('/home', 'HomeController@index')->name('home');\n\n"; | ||
file_put_contents('./routes/web.php', $auth_route_entry, FILE_APPEND); | ||
|
||
// Copy Skeleton auth views from the stubs folder | ||
(new Filesystem)->copyDirectory(__DIR__.'/foundation-stubs/views', resource_path('views')); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
namespace LaravelFrontendPresets\SkeletonPreset; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use Illuminate\Foundation\Console\PresetCommand; | ||
|
||
/** | ||
* Class VuetifyPresetServiceProvider. | ||
* | ||
* @package LaravelFrontendPresets\SkeletonPreset | ||
*/ | ||
class VuetifyPresetServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
PresetCommand::macro('vuetify', function ($command) { | ||
SkeletonPreset::install(false); | ||
$command->info('Vuetify scaffolding installed successfully.'); | ||
$command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); | ||
}); | ||
|
||
PresetCommand::macro('vuetify-auth', function ($command) { //optional | ||
SkeletonPreset::install(true); | ||
$command->info('Vuetify scaffolding with Auth views installed successfully.'); | ||
$command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class HomeController extends Controller | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->middleware('auth'); | ||
} | ||
|
||
/** | ||
* Show the application dashboard. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
return view('home'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
window._ = require('lodash'); | ||
|
||
/** | ||
* We'll load jQuery and the Bootstrap jQuery plugin which provides support | ||
* for JavaScript based Bootstrap features such as modals and tabs. This | ||
* code may be modified to fit the specific needs of your application. | ||
*/ | ||
|
||
try { | ||
window.$ = window.jQuery = require('jquery'); | ||
|
||
require('skeleton'); | ||
|
||
} catch (e) {} | ||
|
||
/** | ||
* We'll load the axios HTTP library which allows us to easily issue requests | ||
* to our Laravel back-end. This library automatically handles sending the | ||
* CSRF token as a header based on the value of the "XSRF" token cookie. | ||
*/ | ||
|
||
window.axios = require('axios'); | ||
|
||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | ||
|
||
/** | ||
* Next we will register the CSRF Token as a common header with Axios so that | ||
* all outgoing HTTP requests automatically have it attached. This is just | ||
* a simple convenience so we don't have to attach every token manually. | ||
*/ | ||
|
||
let token = document.head.querySelector('meta[name="csrf-token"]'); | ||
|
||
if (token) { | ||
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; | ||
} else { | ||
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); | ||
} | ||
|
||
/** | ||
* Echo exposes an expressive API for subscribing to channels and listening | ||
* for events that are broadcast by Laravel. Echo and event broadcasting | ||
* allows your team to easily build robust real-time web applications. | ||
*/ | ||
|
||
// import Echo from 'laravel-echo' | ||
|
||
// window.Pusher = require('pusher-js'); | ||
|
||
// window.Echo = new Echo({ | ||
// broadcaster: 'pusher', | ||
// key: 'your-pusher-key' | ||
// }); | ||
r |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
|
||
{-- Content here --} | ||
|
||
@endsection |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
|
||
{-- Content here --} | ||
|
||
@endsection |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
|
||
{-- Content here --} | ||
|
||
@endsection |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
|
||
{-- Content here --} | ||
|
||
@endsection |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
|
||
{-- Content here --} | ||
|
||
@endsection |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{-- Content here --} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{-- content here --} |