generator-gulp-symfony2

Yeoman generator

Usage no npm install needed!

<script type="module">
  import generatorGulpSymfony2 from 'https://cdn.skypack.dev/generator-gulp-symfony2';
</script>

README

generator-gulp-symfony2 Build Status

Yeoman generator

Change logs:

1.0.5:
  • Support Less.
  • Allow choose 'gulp-sass', 'gulp-less' or 'gulp-compass'.
  • Run bundle install after generate (if use bundle).
1.0.4:
  • Support override 'App domain' (browsersync proxy) via 'app/config/parameters.yml': gulp_symfony2_proxy: 'example.com'.
1.0.3:
  • Fix dest file don't rebuild when 'gulp-symfony2.yml' changed.
  • Run tasks in order.
1.0.2:
  • Use 'gulp-newer' instead of 'gulp-changed'.
  • Fix concat missing files (update).
1.0.1:
  • Fix concat missing files.
  • Move compass temporary files to 'app/Resources/public/.styles'.
  • Only minify when build.
1.0.0:
  • Fix missing bower component images.
  • Fix watch task.
  • Use cache, only process file changed.
  • Handle error.
  • Performance improvements.
  • Change file path in gulp-symfony.yml.

Getting Started

What is Yeoman?

Trick question. It's not a thing. It's this guy:

Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.

Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.

npm install -g yo

Yeoman Generators

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

To install generator-gulp-symfony2 from npm, run:

npm install -g generator-gulp-symfony2

Finally, go to symfony2 root project and initiate the generator:

yo gulp-symfony2

Directory structure

.
├── app
│   └── Resources
│       └── public
│           ├── fonts
│           │   └── roboto
│           │       ├── RobotoCondensed-Regular.eot
│           │       ├── RobotoCondensed-Regular.ttf
│           │       └── RobotoCondensed-Regular.woff
│           ├── images
│           │   └── yeoman.png
│           ├── scripts
│           │   └── bar.js
│           ├── styles
│           │   ├── bar.css
│           │   └── bar.scss
│           └── vendor
├── bower.json
├── config.rb
├── Gemfile
├── Gemfile.lock
├── gulpfile.js
├── gulp-symfony2.yml
├── node_modules
├── package.json
└── web
    ├── fonts
    │   ├── RobotoCondensed-Regular.eot
    │   ├── RobotoCondensed-Regular.ttf
    │   └── RobotoCondensed-Regular.woff
    ├── images
    │   └── yeoman.png
    ├── scripts
    │   └── foo.js
    └── styles
        └── foo.css

How to use

gulp-symfony2.yml:

styles:
  foo.css:
    - app/Resources/public/styles/bar.scss
scripts:
  foo.js:
    - app/Resources/public/scripts/bar.js

Twig:

...
{% block stylesheets %}
  <link rel="stylesheet" href="/styles/foo.css">
{% endblock %}
...
{% block javascripts %}
  <script src="/scripts/foo.js"></script>
{% endblock %}
...
...

Gulp task

Build:

gulp build

Watch & rebuild file changed (dev):

gulp serve

License

MIT