Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Magento theme development con Grunt
02 Integrazione
Dove applicarlo
Come applicarlo
Sviluppi possibili
01 Grunt
Workflow
P...
Workflow – vantaggi e prosettive
Workflow
Standard condivisi
Metodologia di sviluppo
condivisa nel gruppo di lavoro
Riuso ...
Grunt – cosa e perchè
02 Modulare
... adatto per task
semplici e complesse
01 Semplice
… facile da apprendere
e gestire
Th...
Grunt – installazione
Componenti
Grunt Command Line Interface
Grunt modulo, legato al progetto
Dipendenze
Node js -> insta...
Package.json
{
"name": "my-project-name", // Informazione sul progetto
"version": "0.1.0",
"devDependencies": { // Dipende...
Gruntfile.js
module.exports = function (grunt) { // Grunt wrapper
grunt.loadNpmTasks('grunt-contrib-uglify'); // Carica pl...
+
Premessa
Automazioni possibili
Per i preprocessori css Sass, Less e Stylus
Di file css e javascript
Riduzione del peso, ridimension...
Struttura del tema
grunt.loadNpmTasks('grunt-contrib-uglify');
var skinDir = 'skin/frontend/rwd/default/';
var appDir = 'a...
Validazione del codice javascript
$ npm install --save-dev grunt-contrib-jshint
module.exports = function (grunt) {
grunt....
Validazione del codice javascript
Opzioni defaults, override e ignore
jshint: {
options: {
curly: true,
globals: {
jQuery:...
Validazione del codice javascript
Altre funzionalità utili:
1. beforeconcat – afterconcat
2. Ignore specific warning
3. Op...
Compilazione css – SASS/Compass
$ npm install --save-dev grunt-contrib-compass
grunt.loadNpmTasks('grunt-contrib-compass')...
Minificazione file css e javascript
$ npm install --save-dev grunt-contrib-uglify
$ npm install --save-dev grunt-contrib-c...
Concatenazione file css e javascript
$ npm install --save-dev grunt-contrib-concat
grunt.loadNpmTasks('grunt-contrib-conca...
Operazioni sulle immagini
$ npm install --save-dev grunt-contrib-imagemin
grunt.initConfig({
imagemin: {
files: [{
expand:...
Operazioni sulle immagini
$ npm install --save-dev grunt-responsive-images
responsive_images: {
icontask: {
options: {
siz...
Automazione: grunt watch
$ npm install --save-dev grunt-contrib-watch
grunt.initConfig({
watch: {
options: {
livereload: t...
Ed ora LiveReload!
02 Esecuzione
... Grunt processa
relativi task
01 Modifiche
… grunt watch rileva le
modifiche dei file
...
Ed ora LiveReload!
Concentrarsi sul codice mentre sul secondo
monitor si ha sempre la view aggiornata
Ed ora LiveReload!
Controllare il responsive web design su più device
risparmiando tempo
Configurazione del LiveReload!
01 Option del grunt-contrib-watch
02 Inserimento dello script nel template
options: {
liver...
LiveReload integrazione con modulo
01 Portabilità e sicurezza
02 Gestione dal backend
Attivazione
Configurazione
04 Abilit...
LiveReload integrazione con modulo
LiveReload integrazione con modulo
Fine
Marco Rho: Magento theme development workflow con Grunt
Upcoming SlideShare
Loading in …5
×

Marco Rho: Magento theme development workflow con Grunt

1,208 views

Published on

Creare un workflow per lo sviluppo di un tema in Magento, automatizzando processi e integrando framework e preprocessori, è fondamentale non solo per velocizzare i tempi di sviluppo, ma anche perché aiuta il riuso del codice e mantiene facile la manutenzione del progetto. Grunt è un task runner formidabile che permette di realizzare operazioni ripetitive e di eseguirle in cascata in maniera automatica.

In questa presentazione Marco Rho ci mostrerà come creare un workflow per ottimizzare lo sviluppo di un tema di Magento. In particolare, configurerà Grunt in modo da pre-processare file scritti in sass, controllare la sintassi del codice, ottimizzare i tempi di caricamento del sito (minificando i file e ottimizzando in automatico le immagini), ed eseguire il reload automatico della pagina contemporaneamente su diversi device e browser per il testing.

  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Marco Rho: Magento theme development workflow con Grunt

  1. 1. Magento theme development con Grunt 02 Integrazione Dove applicarlo Come applicarlo Sviluppi possibili 01 Grunt Workflow Perchè Grunt Come funziona
  2. 2. Workflow – vantaggi e prosettive Workflow Standard condivisi Metodologia di sviluppo condivisa nel gruppo di lavoro Riuso del codice Facilità di riutilizzo di parte del codice su diversi progetti Velocizzare processi Automazione e centralizzazione delle task Portabilità Possibilità di creare il develepment flow facilmente su diversi progetti
  3. 3. Grunt – cosa e perchè 02 Modulare ... adatto per task semplici e complesse 01 Semplice … facile da apprendere e gestire The javascript Task runner 03 Community ..attualmente vanta più di 4000 plugin
  4. 4. Grunt – installazione Componenti Grunt Command Line Interface Grunt modulo, legato al progetto Dipendenze Node js -> installabile dal Node Package Manager Versione legata a progetto $ npm install -g grunt-cli // installa a livello globale Grunl CLI $ npm init // Crea il package.json $ npm install --save-dev grunt // Installa grunt (cartella di progetto)
  5. 5. Package.json { "name": "my-project-name", // Informazione sul progetto "version": "0.1.0", "devDependencies": { // Dipendenze "grunt": "~0.4.5", ~ MINOR release - 0.4.x "grunt-contrib-jshint": “^0.10.0", ^ MAJOR release – 0.x.x "grunt-contrib-nodeunit": "^0.4.1", "grunt-contrib-uglify": "^0.5.0" } } $ npm install // Installa tutti i moduli richiesti
  6. 6. Gruntfile.js module.exports = function (grunt) { // Grunt wrapper grunt.loadNpmTasks('grunt-contrib-uglify'); // Carica plugin grunt.initConfig ({ // Definizione della funzione uglify: { my_target: { files: { 'src/js/script.min.js' : ['component/js/*.js'] } } }, }) grunt.registerTask('default', 'uglify') // Definizione funzione default }
  7. 7. +
  8. 8. Premessa
  9. 9. Automazioni possibili Per i preprocessori css Sass, Less e Stylus Di file css e javascript Riduzione del peso, ridimensionamento immagini per diverse risoluzioni Controllo sintassi Compilazione CSS Minificazione e concatenazione Ottimizzazione immagini Validazione del codice javascript JSHint
  10. 10. Struttura del tema grunt.loadNpmTasks('grunt-contrib-uglify'); var skinDir = 'skin/frontend/rwd/default/'; var appDir = 'app/design/frontend/rwd/default/'; grunt.initConfig ({ uglify: { my_target: { files: { skinDir + ‘js/script.min.js' : [skinDir + 'component/js/*.js'] } } }, }) APP Xml – tmpl Skin JS – CSS – Font – images Src Js – sass – images
  11. 11. Validazione del codice javascript $ npm install --save-dev grunt-contrib-jshint module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-jshint');// Carica plugin grunt.initConfig ({ jshint: { // Definisco funzione all: [skinDir + 'js/*.js'] // Target } }); grunt.registerTask('default', 'uglify') } http://jshint.com/ - testing e documentazione
  12. 12. Validazione del codice javascript Opzioni defaults, override e ignore jshint: { options: { curly: true, globals: { jQuery: true }, }, src: [skinDir + 'js/*.js'], } uses_defaults: [’src/js/*.js'], with_overrides: { options: { curly: false, ignores: [’lib/jquery.js'] }, files: { src: [lib/**/*.js’], }, }
  13. 13. Validazione del codice javascript Altre funzionalità utili: 1. beforeconcat – afterconcat 2. Ignore specific warning 3. Options in file esterno
  14. 14. Compilazione css – SASS/Compass $ npm install --save-dev grunt-contrib-compass grunt.loadNpmTasks('grunt-contrib-compass'); grunt.initConfig ({ compass: { dev: { options: { config: sourceDir + 'scss/config.rb’, } } } }); !!! Configurare ambiente – ruby, sass e compass http_path = "/skin/frontend/rwd/default/" css_dir = "css" sass_dir = "scss" images_dir = "images" fonts_dir= "fonts" javascripts_dir = "js" relative_assets = true require 'susy' output_style = :expanded environment = :development Config.rb
  15. 15. Minificazione file css e javascript $ npm install --save-dev grunt-contrib-uglify $ npm install --save-dev grunt-contrib-cssmin grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.initConfig({ uglify: { my_target: { files: [{ expand: true, cwd: sourceDir + ‘js/*.js', src: '**/*.js', dest: skinDir + 'js/*.js' }] } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.initConfig({ cssmin: { target: { files: [{ expand: true, cwd: skinDir + 'css', src: ['*.css', '!*.min.css'], dest: 'skinDir + 'css', ext: '.min.css' }] } } }); CssminUglify
  16. 16. Concatenazione file css e javascript $ npm install --save-dev grunt-contrib-concat grunt.loadNpmTasks('grunt-contrib-concat'); grunt.initConfig({ concat: { basic_and_extras: { files: { skinDir +'js/main.js': [sourceDir +'js/main.js’, sourceDir+'js/menu.js’, sourceDir+'js/carousel.js'], }, }, }, }); Uglify Magento backend Sistema>configurazione>sviluppa: Javascript settings Sistema>configurazione>sviluppa: Css settings
  17. 17. Operazioni sulle immagini $ npm install --save-dev grunt-contrib-imagemin grunt.initConfig({ imagemin: { files: [{ expand: true, cwd: sourcesDir + 'images/', src: ['**/*.{png,jpg,gif}'], dest: skinDir + 'images/' }] } }); grunt.registerTask('default', ['newer:imagemin']); Opzioni Compressione Plugin Si raccomanda Grunt-newer npm install grunt-newer --save-dev grunt.loadNpmTasks('grunt-newer');
  18. 18. Operazioni sulle immagini $ npm install --save-dev grunt-responsive-images responsive_images: { icontask: { options: { sizes: [{ width: 32, height: 32 },{ width: 64, suffix: "_x2", quality: 60 }] }, files: [{ expand: true, src: ['**/*.{jpg,gif,png}'], cwd: sourceDir + 'images/icon', dest: skinDir + 'images/icon' }] } }, }) Opzioni Size Compression Suffix Name Si raccomanda Grunt-newer
  19. 19. Automazione: grunt watch $ npm install --save-dev grunt-contrib-watch grunt.initConfig({ watch: { options: { livereload: true }, watchactivity: { files: [ sourceDir + 'images/**/*.{png,jpg,gif}' ], tasks: [ 'imagemin' ] } }, }) File da monitorare App/design/frontend/rwd/default/ XML – etc e layout App/design/frontend/rwd/default/ Phtml – template App/skin/frontend/rwd/default/ JS – src/js Sass – src/sass Image – sec/images
  20. 20. Ed ora LiveReload! 02 Esecuzione ... Grunt processa relativi task 01 Modifiche … grunt watch rileva le modifiche dei file 03 Refresh …come ultimo step della catena
  21. 21. Ed ora LiveReload! Concentrarsi sul codice mentre sul secondo monitor si ha sempre la view aggiornata
  22. 22. Ed ora LiveReload! Controllare il responsive web design su più device risparmiando tempo
  23. 23. Configurazione del LiveReload! 01 Option del grunt-contrib-watch 02 Inserimento dello script nel template options: { livereload: true, // true: porta 35729 se no specificare } <reference name="head"> <block type="core/text" name=”grunt.livereload"> <action method="setText"> <text><![CDATA[ <script type="text/javascript" src="http://shop.blumango.it:35729/livereload.js"></script> ]]></text> </action> </block> Local.xml
  24. 24. LiveReload integrazione con modulo 01 Portabilità e sicurezza 02 Gestione dal backend Attivazione Configurazione 04 Abilitazione live reload con cookie o utente Evitare il refresh a developer non interessati Evitare di dover gestire le opzioni su diversi dispositivi 05 Gestione della porta per utente Permette il refresh su Grunt multitask
  25. 25. LiveReload integrazione con modulo
  26. 26. LiveReload integrazione con modulo
  27. 27. Fine

×