-
Notifications
You must be signed in to change notification settings - Fork 10
Grunt and bower instead of assetic #1
Conversation
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
We will loop all bundles in the src folder and move all the assets into one folder. When that is done we will compile the sass-files
From now on you will be able to just run "grunt" and everything will be watched, and the correct actions will be executed on file-change
This reverts commit 07039ab.
|
Note that this is a work in progress |
composer.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cfc72be
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je gebruikt zowel "prod" als "Production" in deze file, ik zou voor een consistente benaming gaan (en imo is production beter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a7e727e426f7acb22598f28197aa1ae7a5f51518
|
When merging this, I'd squash some of the commits. I don't think it adds a lot of value to have 65 commits for this integration. |
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
|
Squashed version of some commits in #5 |
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
will be "compiled" with assetic
grunt watchisn't runningCoffee
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.