Giter VIP home page Giter VIP logo

diglin_uioptimization's Introduction

Diglin_UIOptimization

It is a Magento module which allows you to optimize and minify your css and js files by allowing you to use different available compression libraries and methods. It's completely configurable following the capabilities of each libraries

Features

  • Available libraries CSSTidy, JSMin ( Douglas Crockford), Google Minify (Same as the one of Fooman Speedster) or the YUI Compressor (Java required).
  • Compatible with the merging CSS and JS feature of Magento
  • Works with any css and js files included in layout files using action methods: addCss, addJs, and addItem (skin_js, skin_css and js)
  • It doesn't modifiy your originals files
  • Update the optimized files when the original are modified automatically or periodically (sunday at 2:00 or configurable via Magento cron). Generate a unique file to force browser refreshing if the file has been modified.
  • Compatible with https website and relative urls. (it fixes a bug in Magento prior to 1.5.1)

Canonical URL

Inspired by the module from Yoast, this feature allows you to create canonical urls of your catalog (products, categories, search products and cms pages). Please visit the website of Yoast for more information: http://yoast.com/articles/magento-seo/

This feature is implemented in this module too, to help you to have less as possible different modules.

HTML and CSS validator

  • Enable / disable each function
  • Use the W3C Webservice validator
  • For testing purpose, display at the bottom of each page of your Magento frontend the validation of your CSS or HTML. Don't use both otherwise it will be slow to display each page.
  • Allow you to configure default and / or fallback values (doctype, charset, language, ...)
  • Allow you to define a local HTML validator server for quickest validation and local development (No local CSS validator server available for the moment). In local development, you need to do it otherwise the W3C Validator could not get access to your local development website

Requirements

  • If you wish to use YUI Compressor. Java on your server is required. You need to provide in the configuration of this module, the path of the binary if different of the environnement default one.

Documentation:

Via Magento Connect

Via modman

  • Install modman
  • Use the command from your Magento installation folder: modman clone https://github.com/diglin/Diglin_UIOptimization.git

Manually

  • You can copy the files from the folders of this repository to the same folders of your installation

Optionaly

  • For those who use the CommerceBug module, contact me to give you the scripts for it. The script for CommerceBug display the W3C validator for HTML and CSS.

Configuration

Follow the instructions in the configuration page In case of Access Denied in the backend: clear your cache, logout/login. In case, it still doesn't work, save again the user role in System > Permissions > Roles. This module is not compatible with Fooman Speedster and Yoast Canonical Url modules. Deactivate them before to use this module by editing the app/etc/modules/MODULE_TO_DEACTIVATE.xml of the module and set enable to false.

Deinstall

  • If you used MagentoConnect, you may use the deinstall process of the Magento Connect Backend page view of your Magento installation.
  • Otherwise remove the files following the hierarchy of the folders of this repository

Author

Donation

Invite me for a drink

Profiling

As promised, I provide you below the statistic of compression and ratio by using the different libraries:

Compressed/Minified file statistic and comparison by using default Magento template, sample data, configuration for Diglin User Interface Optimization module is for all by default. Only the method to compress/minify is changed. Merging file has no influence on compression but has influence on number of HTTP requests which is also an important point.

**** JS compression (analyzed with YSlow):

  • no compression, no miniying, no merging: 329.8 Kb

  • JSMin (unmerged, no gzip): total 230.4Kb (31% of compression)

  • JSMin (merged, no gzip): total 230.4Kb

  • JSMin (merged, gzip): total 56.8Kb (compression 83%)

  • YUI compressor (unmerged, no gzip): total 193.6 Kb (compression 41%)

  • YUI compressor (merged, no gzip): total 193.6 Kb

  • YUI compressor (merged, gzip): total 52.6 Kb (compression 84%)

  • Packed (unmerged, no gzip): total 133.5 Kb (compression 59%)

  • Packed (merged, no gzip): total 133.5 Kb

  • Packed (merged, gzip): total 44.5 Kb (compression 86.5%)

**** CSS compression (analyzed with YSlow):

  • no compression, no miniying, no merging, no gzip: 95.9 kb

  • CSS Tidy (unmerged, no gzip): total 79.8 Kb (compression 17%)

  • CSS Tidy (merged, no gzip): total 79.8 Kb

  • CSS Tidy (merged, gzip): total 14.7 Kb (compression 85%)

  • YUI compressor (unmerged, no gzip): total 82.7 Kb (compression 14%)

  • YUI compressor (merged, no gzip): total 82.7 Kb - YUI compressor (merged, gzip): total 14.5 Kb (compression 85%)

  • Google Minify (unmerged, no gzip): total 79.9 Kb (compression 17%)

  • Google Minify (merged, no gzip): total 79.9 Kb - Google Minify (merged, gzip): total 14.9 Kb (compression 84.5%)

CONCLUSION:

  • for JS: 1) YUICompressor 2) JSMin 3) Packed (for compatibility problem with Magento)
  • for CSS: 1) CSSTidy 2) Google Minify (almost good as CSSTidy) 3) YUICompressor

diglin_uioptimization's People

Contributors

ibrahimgunduz34 avatar mmenozzi avatar mystix avatar sylvainraye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diglin_uioptimization's Issues

PHP 7.2 warnings

Warning: count(): Parameter must be an array or an object that implements Countable in app/design/frontend/base/default/template/uioptimization/w3ccssvalidator.phtml on line 45

system.log:Warning: count(): Parameter must be an array or an object that implements Countable in app/design/frontend/base/default/template/uioptimization/w3chtmlvalidator.phtml on line 48

Issue on windows server (Directory Separator seems to be the reason)

Message from Wolfgang via MagentoConnect

Hello,

I just checked your tool to combine the js and css files. I used Magento 1.8.0 on a linux server (webhoster) and it works. For testing purposes I copied the installation to my local Windows-PC (Win7 64 Bit) and use the Zend-Server (from Zend-Studio) as host. Here are problems: When enabling the compression/optimization for css or js on the Windows system the files are not combined but the pathnames are processed wrong: 
normaly a path looks like:

after enabling the optimization it looks like:

The js file in the media area was created successfully, but backslashes instead of slashes will not work. May be this is also the reason why the files are not combined.

I hope, this info will help to improve your good tool.

Greetings, 
Wolfgang

Fonts aren't rendering

Hey Silvain, first off thanks for this fantastic module!

Question - I'm using CSS Tidy compression at the Highest compression level. It's removing quote aren't fonts.

Changing

font-family: "Futura-Bold"

to

font-family: Futura-Bold

Which is causing Chrome at least not to render the font. Any thoughts?

No minification

Hi

I have installed and set up everything as I believe it should be but despite flushing caches including APC I can't get either the CSS or JS minifcation working.

I have selected CSS Tidy for CSS minify and JSMin for JS Minify type.

Do you know what could be wrong?

Thanks

PHP Warning: is_file() [function.is-file]: File name is longer than the maximum allowed path length on this platform (4096)

Bonjour,

J'ai essayé de poster ce signalement sur magento-connect mais ma critique ne se sauvegarde pas chez eux.

J'ai rencontré un bug récemment sur une nouvelle installation Magento

PHP m'affichait une erreur :
PHP Warning: is_file() [function.is-file]: File name is longer than the maximum allowed path length on this platform (4096):

La solution est de modifier le fichier présent à :
lib/Diglin/Io/Files.php

Remplacer la ligne (environ ligne 39) :
if (is_string($src) && is_readable($src)) {

Par
if (is_string($src) && strpos($src, "\n") === FALSE && is_readable($src)) {

ça marche parfaitement maintenant.

Cordialement,
Ilan


Good evening,

I discovered a new bug recently.
I don't know exactly the reason. So far it worked with all my projects.

PHP throws this error :
PHP Warning: is_file() [function.is-file]: File name is longer than the maximum allowed path length on this platform (4096):

Solution :
File lib/Diglin/Io/Files.php
Line 39

Remplace :
if (is_string($src) && is_readable($src)) {

By :
if (is_string($src) && strpos($file, "\n") === FALSE && is_readable($src)) {

Works like a charm now.

Cheers,
Ilan

File versioning

Hey there.

I have implemented this module and its a great improvement on file sizes, thanks.

I'm having an issue with the versioning of files though. It renames my files with 'filename' + '_1_cp.css'.

No matter how many times I update the file and flush the cache I cannot get it to update the '1_cp' part.
This is causing issues as I'm using browser caching and cannot force the css to update. Any ides on how to fix this?

Cheers
Darren

Error when enable 'merge css files' in magento

Magento 1.7.0.2
Notice: Uninitialized string offset: 0 in /var/www/vhosts/boxshopdev.dev/lib/Diglin/Csstidy/Print.php on line 170
#0 /var/www/vhosts/boxshopdev.dev/lib/Diglin/Csstidy/Print.php(170): mageCoreErrorHandler(8, 'Uninitialized s...', '/var/www/vhosts...', 170, Array)
#1 /var/www/vhosts/boxshopdev.dev/lib/Diglin/Csstidy/Print.php(98): Diglin_Csstidy_Print->_print(true)
#2 /var/www/vhosts/boxshopdev.dev/app/code/community/Diglin/UIOptimization/Block/Optimize/Head.php(161): Diglin_Csstidy_Print->plain()
#3 /var/www/vhosts/boxshopdev.dev/app/code/community/Diglin/UIOptimization/Block/Optimize/Head.php(59): Diglin_UIOptimization_Block_Optimize_Head->_prepareCssCompression('css/styles.css', Array)
#4 /var/www/vhosts/boxshopdev.dev/app/code/core/Mage/Page/Block/Html/Head.php(202): Diglin_UIOptimization_Block_Optimize_Head->_prepareStaticAndSkinElements('

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.