Component Generator
, (*1)
Inspired by Bourbon Refill's Rails generators, Component Generator is a Laravel 4 package to quickly generate HTML components from Web Frameworks such as Twitter Bootstrap via command line., (*2)
Getting Started
By default running the following command will create a new file in views/components/navbar.blade.php with the Twitter Bootstrap navigation bar., (*3)
php artisan component:generate navbar
If you want to change the directory the file is created in your can use the --path option, (*4)
php artisan component:generate navbar --path="app/views"
To append a component to an already existing file use component:append
, (*5)
php artisan component:append navbar layouts.default
The first argument is the component. The second argument is the template to append to - located inside of app/views., (*6)
Installation
"acoustep/component-generator": "dev-master"
Add the service provider, (*7)
'Acoustep\ComponentGenerator\ComponentGeneratorServiceProvider',
If you wish to change your settings you can run, (*8)
php artisan config:publish acoustep/component-generator
Or, (*9)
php artisan component:setup
Configuration
'framework' => 'bootstrap3'
This is the name of the directory to copy views from. Alternatives include foundation5 and pure1., (*10)
'directory' => 'components'
Where the components are copied to. This will be in the app/views
directory. To copy them to the root of views
change it to an empty string., (*11)
'prefix' => ''
Put a prefix on filenames. For instance, if you come from a Rails background and prefer to use an underscore to prefix partials then you can set that here., (*12)
'postfix' => '.blade.php',
'syntax' => 'blade',
Don't use blade? You can change to normal PHP templates with the following settings, (*13)
'postfix' => '.php',
'syntax' => 'php',
Components
To list all the components via command line use, (*14)
php artisan component:list
To view a specific framework's components pass in the framework option, (*15)
php artisan component:list --framework=bootstrap3
Zurb Foundation
- accordion
- alerts
- breadcrumb
- button-dropdown
- button-group
- button-split
- equalizer
- form
- iconbar
- joyride
- layout
- modal
- offcanvas
- orbit
- pagination
- panel
- pricing-table
- progress
- range-slider
- table
- tabs-vertical
- tabs
- thumbnails
- tooltip
- topbar
- video
Pure
- form-aligned
- form-inline
- form-multi
- form
- layout
- menu
- pagination
- table
To do
- Ability to publish views for customising before generation.
Credits
The base of this code is from Jeffrey Way's Book Laravel Testing Decoded. A great book which has helped me a lot!, (*16)