This repository was archived by the owner on Feb 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Grunt and bower instead of assetic #5
Merged
WouterSioen
merged 56 commits into
master
from
squashed-grunt-and-bower-instead-of-assetic
Feb 16, 2015
Merged
Grunt and bower instead of assetic #5
WouterSioen
merged 56 commits into
master
from
squashed-grunt-and-bower-instead-of-assetic
Feb 16, 2015
Conversation
This file contains hidden or 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
We will install bower through npm In package.json all required (node-)modules will be listed.
As we will dump assetic, and use bower + grunt instead.
The files will be copied into place by grunt
This will generate all required font-files based on just the ttf or eot-files
Actually we should run this in our vm, but I don't like that, therefore I just remove the folders, so the cache is regenerated on reload.
As the fonts can be referenced in the css-files with a directory we should preserver the folder structure
This is fixed by copying the file into the correct location. When woff2-support isn't experimental anymore we should enable it in fontgen
This is fixed by copying the file into the correct location.
As we don't plan to use the framework on HHVM. But it is a nice test to see if it works ;-)
…ic and reflect what it does
8 tasks
WouterSioen
added a commit
that referenced
this pull request
Feb 16, 2015
…d-of-assetic Grunt and bower instead of assetic
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using grunt
We are using grunt to handle a shitload of frontend related tasks, below you
can find all stuff that is done. This is more a guide for you to understand
what is happening.
@todo
Coffee
We will look into all bundles in the
src-folder for all files in theResources/assets/coffee-folder, these files will be copied to theassets/coffee-folder in the root directory. All files will be prefixed withthe lowercased bundlename.
After that the files will be compiled into
web/assets/js.As this will generate seperate files for each file we will combine them through
assetic. See How to use Assetic for asset management
for the full documentation but basically:
Fonts
We will look into all bundles in the
src-folder for all the ttf and otf-filesin the
Resources/assets/fonts-folder, these files will be copied toassets/fonts-folder in the root directory. When this is done all the otherformats (eot, svg, ttf, woff) are created in the
web/assets/fonts-folder.You can link to the font-files with the compass-shortcurt font-url('filename')
in your scss-files.
Icons
We will look into all bundles in the
src-folder for all the svg-files in theResources/assets/icons-folder, these files will be compiled into an iconfontlocated in
web/assets/fonts-folder in the root directory. A _icons.scss-filewill be stored in the
assets/sass-folder.Images
We will look into all bundles in the
src-folder for all files in theResources/assets/images-folder, these files will be copied to theweb/assets/images-folder in the root directory. The folder structure you(optionally) created will be preserved.
Important: make sure you don't have duplicate filenames as the files will be
overwritten.
You can link to the font-files with the compass-shortcurt image-url('filename')`
in your scss-files.
When running
grunt buildthe images will be optimized for web with thegrunt-contrib-imagemin-plugin.
You can use the
asset-method in twig templates like below:JS
We will look into all bundles in the
src-folder for all files in theResources/assets/js-folder, these files will be copied to theweb/assets/js-folder in the root directory. The folder structure you(optionally) created will be preserved.
You can use the
asset-method in twig templates like below:SASS/SCSS
We will look into all bundles in the
src-folder for all files in theResources/assets/sass-folder, these files will be copied to theassets/sass-folder in the root directory. The folder structure you(optionally) created will be preserved.
After that the files will be compiled into
web/assets/css. When runninggrunt buildthe files will be compiled as minified as possible, so withoutany comments.
When the sass/scss-files are compiled we use the
grunt-autoprefixer-plugin
If you want you can combine multiple generated css files into one by using
Assetic:
But in most cases you will just use
Usage
While developing
We have implemented live-reload, so your changes will be reloaded in the
browser. This will only happen in the dev-environment.
Before launching your website
You don't have to bother if you are using deployment as we will handle it for
you.