Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

generator-zf5

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-zf5

Yeoman generator for Zurb Foundation 5

  • 0.9.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

generator-zf5

Yeoman generator for Zurb Foundation 5.

Important note:

Default option here will be Sass with Libsass (for now). But you can choose Ruby version on startup.

From Foundation 5.5.0: "Foundation is now compatible with Sass 3.4! Note: this removes Sass 3.2 compatability." Foundation 5 Changelog

NPM

NPM

Yo Foundation 5!

  • Sass compiling
  • Jade templating engine (option)
  • Publishing to dist directory
  • Server with LiveReload (127.0.0.1:9000)
  • Bower install
  • JSHint
  • Font Awesome (option)

Getting Started

$ npm install -g yo

To install generator-zf5 from npm, run:

$ npm install -g generator-zf5

Finally, initiate the generator:

$ yo zf5

Grunt tasks:

run project (compile Jade, compile Sass, bower install, livereload (server on 127.0.0.1:9000), watch)

$ grunt

publishing project (into dist directory) (compile Jade, compile Sass, validate-js, copy, concatenation, minifications)

$ grunt publish

dist directory preview (server on 127.0.0.1:9001)

$ grunt server-dist

Other Grunt tasks (if you want to use it)

..for validating javascript

$ grunt validate-js

..for injecting bower libraries (also in default grunt task)

$ grunt bower-install

..for compiling Sass files

$ grunt compile-sass

..for compiling Jade files

$ grunt compile-jade

Ruby Sass with Compass or Node Sass (Libsass)

From version 0.7.0 you can use Ruby version of Sass with Compass. If you want to use Ruby version first of all you need to install compass by 'gem install compass' (it will install Sass gem too).

You don't need to use the config.rb file, all is configured in Gruntfile.js (Sass block). There will be also Compass imports in _appstyles.scss (You can modify it). If you have any problems with using Sass with Compass it is good to uninstall any of your Sass gems and Compass gems and install only Compass gem again. It will fetch proper version of Sass gem.

Ruby Sass config info: https://github.com/gruntjs/grunt-contrib-sass

You can also use Libsass version (default) which is very fast, but it is compatible with only older Sass 3.3. For Foundation it is ok. And I think soon it will be improved.

Node Sass config info: https://github.com/sindresorhus/grunt-sass

Please test this and send issues if any.

Jade templating engine (early stage.. PR are welcomed)

From version 0.8.0 you can use Jade templating engine (option). It gives you clean and simple html syntax and (whats important) it allows you to use partials includes like header or footer. Example:

html(class="no-js", lang="en")
    include partials/header
    body
        div.row
            div(class="small-12 columns panel radius")
                h1 Yo Foundation 5!
                h2(class="text-right")
                    a(href="https://github.com/juliancwirko/generator-zf5")
                        i(class="fa fa-twitter")
        include partials/footer
Problems to solve:
  • jade-usemin
  • bower install (wiredep) with Jade
  • paths etc...
  • all as the Jade option in Yeoman prompts convention..

More about Jade: http://jade-lang.com/

LiveReload

For LiveReload call 'grunt' (watching) command and go to http://127.0.0.1:9000

Usemin

Read more about grunt-usemin

Bower-install

Now you can install your libraries much faster. Example:

bower search magnific-popup
...
bower install magnific-popup --save
...
grunt bower-install

This should inject the proper js and css paths into your html files. But you should be careful and check what was injected. 'grunt publish' will then minify and concatenate them into a clean (libraries.min.css and libraries.min.js) files. Instead of a 'bower install' with '--save' you can manualy edit the bower.json file and then run a 'grunt bower-install'. It is also included in the default task - 'grunt'.

Tips

  • Sometimes after new version is released if you have errors when running yo zf5 You should run npm cache clean
  • If you have problems with permissions in Linux run this : sudo chown -R `whoami` ~/.npm
  • if you want you can delete not used javascript components in index.html file. All remaining components will be minified and concatenated into one foundation.min.js
  • if you have problems with connection to http://127.0.0.1:9000 change 'hostname' in Gruntfile.js 'connect' config. Just add hostname: '[your hostname]' line to options: {...}
  • if you want you can delete unnecessary/unused Foundation components from main app.scss (it will be lightest main Foundation css file)
  • place all your html files in the root folder (app) or you have to change assets paths (build etc.)
  • grunt useminPrepare reference file is only index.html (prevents multiple the same operations) but all html files will be processed, so remember to keep the same usemin 'comments blocks' in all your html files (for now it is good to simply copy index.html, rename it and leave header and footer css and js inclusions with 'comments blocks')
  • try to avoid situation when you have the same build blocks in two html files with different assets so (examples):
<!-- build:js js/mfpopup/mfpopup.min.js -->
    <script src="js/mfpopup/mfpopup.js"></script>
<!-- endbuild -->

and

<!-- build:css css/mfpopup/mfpopup.min.js -->
    <script src="js/mfpopup/mfpopup.js"></script>
    <script src="js/mfpopup/other_script.js"></script>
<!-- endbuild -->

you can add new ones

  • always verify what 'grunt bower-install' injects
  • You must look aut where you initialize your project. It is better to not initialize your projec in a subfolder next to .yo-rc.json because your files will land here and not in your subfolder from where you are initializing project
  • if you use Compass.. place your mixin includes after Foundation scss partials - more info (by default they are in _appstyles.scss)
  • if you use Jade templating remember to place at least header.jade and footer.jade in main app folder - this is needed for bower install injections

You can test it and tell me please if something is not working.

Getting To Know Yeoman

Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.

If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.

License

MIT License

Maybe someone (English speaker) would like to prepare tutorial for zf5 generator? I will be very thankful :)

Contact

@juliancwirko | julian.cwirko@gmail.com

Changelog

..see CHANGELOG.md file

Keywords

FAQs

Package last updated on 13 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc