rande / swcombineplugin Goto Github PK
View Code? Open in Web Editor NEWCombine stylesheets and javascripts files, with no computation at runtime
License: MIT License
Combine stylesheets and javascripts files, with no computation at runtime
License: MIT License
Seriously, no YUI compressor?
Must have, should be in drivers by default. I will attach it here when I finished it.
Hi,
since the definition of JS and CSS in views.yml is deprecated as said here:
http://www.symfony-project.org/reference/1_4/en/13-View#chapter_13_javascripts
this plugin will work when JS and CSS are defined only using helpers in the layout.php and different module templates?
The current revision of plugin doesn't work on windows servers, here are 2 patches to fix the issue
Index: swCombineStylesheet.class.php
===================================================================
--- swCombineStylesheet.class.php (revision 47)
+++ swCombineStylesheet.class.php (working copy)
@@ -140,7 +140,7 @@
if($file)
{
- return 'url('.$file.')';
+ return 'url('.str_replace('\\', '/', $file).')';
}
$this->logSection('fix-image', 'unable to find the file : '.$matches[2]);
AND
Index: swOptimizeCreateFilesTask.class.php
===================================================================
--- swOptimizeCreateFilesTask.class.php (revision 47)
+++ swOptimizeCreateFilesTask.class.php (working copy)
@@ -146,9 +146,10 @@
->maxdepth(0)
->in(sfConfig::get('sf_app_module_dir'));
+ $r = str_replace("\\", '/', sfConfig::get('sf_app_module_dir').'/');
foreach($app_modules as $module)
{
- $modules[] = str_replace(sfConfig::get('sf_app_module_dir').'/', '', $module);
+ $modules[] = str_replace($r, '', $module);
}
Salut Thomas,
J'ai l'erreur suivante :
Unable to replace file "(...)web/sw-combine/frontend/aa9b219f67624074aa6ae611eb06bda0.js" with optimized contents
Voici ce que donne un ls -la :
total 128
drwxr-xr-x 2 restaurant-levasion restaurant-levasion 4096 2011-03-15 11:53 .
drwxr-xr-x 3 restaurant-levasion restaurant-levasion 4096 2011-03-15 11:52 ..
-rw-r--r-- 1 root root 29499 2011-03-15 11:53 12484cee2a614e047c4c9ea7cbc4f95c.css
-rw-r--r-- 1 root root 23301 2011-03-15 11:53 1f034bb723f35c9164cf653ca7764d41.js
-rw-r--r-- 1 root root 24138 2011-03-15 11:53 459cb1dc4fa76b8c3948dfa4933b8890.css
-rw-r--r-- 1 root root 0 2011-03-15 11:53 aa9b219f67624074aa6ae611eb06bda0.js
-rw-r--r-- 1 root root 39589 2011-03-15 11:53 aa9b219f67624074aa6ae611eb06bda0.js.tmp
For now the plugin does not support the media propery
this would allow setting an infinite expire on the sw-combine directory.
it also makes including the generated files into the front-end a bit difficult obviously.
I created the right packages (my_package) in config_handlers.yml and ran the optimization scripts successfully. Unfortunately, when I include this in any view.yml file
sw_combine:
include_packages:
javascripts: [my_package]
stylesheets: [my_package]
the include do not pull in anything via the sw_include_stylesheets(); or sw_include_javascripts(); helper functions.
Tried everything, nothing seems to work.
The sw_include_stylesheets() (and js equivalent) doesn't seem to consider the 'public_path' setting. My CSS and JS is properly combined and placed into 'web/assets' but when the pages are rendered they link to the files like /459cb1dc4fa76b8c3948dfa4933b8890.css. As if they were in the web root.
'private_path' is set to "%SF_WEB_DIR%/assets" and 'public_path' to "/assets".
When I tried to set them to only "%SF_WEB_DIR%" and "/" then it worked. Only then it wiped everything else in my web root, like the index.php and robots.txt.
Also, possibly related, my setting for 'version' is not detected in the helper. I tried printing the $params variable in the helper but go only the the default false value for 'version'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.