trentrichardson / cakephp-shrink Goto Github PK
View Code? Open in Web Editor NEWShrink is a CakePHP plugin to Compile, Combine, Compress js, css, less, sass, coffee assets
Shrink is a CakePHP plugin to Compile, Combine, Compress js, css, less, sass, coffee assets
Hi Trent
I'd like to contribute to this repo. How can I do that? I don't see any contribution guides on readme.md
Regards,
clthck
Hi me again :)
I've download the latest version of shrink to test the inclusion of Scssphp to do the compiling of Sass files via PHP instead of Ruby.
It works fine for single files but not for imports.
e.g.
If I pass it a file with JUST the following inside:
@import "compass/utilities";
@import "compass/typography";
@import "compass/css3";
The returned code will be empty.
To test this further I amended the code like so:
$code = $scss->compile(file_get_contents($file->read()));
echo $code; exit;
and I get the following errors:
Warning (2): file_get_contents(@import "compass/utilities";
@import "compass/typography";
@import "compass/css3";
) [function.file-get-contents]: failed to open stream: No such file or directory [APP/Plugin/Shrink/Lib/ShrinkType/ShrinkCompiler/ShrinkCompilerScss.php, line 36]
So I'm wondering is the plugin struggling to find the files? Or this error just because of my test? Either way the imports are not working :) Any ideas?
Thanks once again.
I am using your plugin "Shrink CakePHP Plugin" but the plugin this unifying and minifying the .css files but not minifying the .js files (though this unifying all .js files), what the reason for this behavior and how to prevent this behavior?
How I'm using:
In my home.ctp (inside head tags):
Shrink->css(['Bootstrap/css/bootstrap.min.css', 'font-awesome-4.3.0/css/font-awesome.min.css', 'datepicker/css/datepicker.css', 'jquery-bxslider/jquery.bxslider.css', 'style.css', 'menu-plugin.css']) ?> <?= $this->Shrink->js(['jquery-1.11.1.min.js', 'bootstrap.min.js',
'Jquery-Validate/jquery.validate.min.js', 'datepicker/js/bootstrap-datepicker.js',
'jquery-bxslider/jquery.bxslider.min.js', 'main.js']) ?>
<?= $this->Shrink->fetch('css') ?>
<?= $this->Shrink->fetch('js') ?>
In AppController.php (inside initialize() method) I add this line:
$this->helpers[] = 'Shrink.Shrink';
Is there a way to fetch the files from a plugin directory loaded with Bootstrap that is in the vendor directory?
With the HTML helper File you can fetch a JS file like:
$this-Html->script('Pluginname.Filename');
But this is not possible if you do something like:
$this->Shrink->js('Pluginname.Filename.js');
What is the best way to achieve this?
Many thanks
$webCacheFilePath = $this->settings['url'] . preg_replace('//+/', '/', '/'. $this->extraPath .'/'. $this->settings[$type]['cachePath'] . $cacheFile); // line 181
i would change to
$webCacheFilePath = $this->settings['url'] . preg_replace('//+/', '/', '/'. $this->extraPath .'/'. $this->settings[$type]['cachePath'] . $cacheFile);
$webCacheFilePath = $this->assetUrl($webCacheFilePath, array() + array('pathPrefix' => Configure::read('App.cssBaseUrl')));
I have added the following to my layout file:
echo $this->Shrink->css(array('_compass.scss'), true);
echo $this->Shrink->fetch('css');
and I get this error:
Fatal error: Call to undefined method ShrinkCompilerScss::run() in /html/2013/app/Plugin/Shrink/Lib/ShrinkType/ShrinkCompiler/ShrinkCompilerScss.php on line 34
Any ideas?
Hi
Tried to use this plugin but it can not load for example a css file from a plugin webrott/css folder.
I debugged it and found the problem in Shrink.php
$plugin_path = preg_replace('/(/+|\+)/', DS, APP . DS . 'plugins' . DS . $plugin . DS . 'webroot' .DS. $plugin_rel_path);
APP = /src
plugins are in /plugins (same level as src in CakePhph 3)
So APP . 'plugins' = /src/plugins it should be /plugins
All the best
Joop van Duin
I get a parse error while compiling _variables.scss from Bootstrap 4 framework.
parse error: failed at
@each $key, $num in $map { /../scss/bootstrap-4.0.0/_variables.scss on line 47
The code is:
@mixin _assert-ascending($map, $map-name) { $prev-key: null; $prev-num: null; @each $key, $num in $map { @if $prev-num == null { // Do nothing } @else if not comparable($prev-num, $num) { @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !"; } @else if $prev-num >= $num { @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !"; } $prev-key: $key; $prev-num: $num; } }
I know, Bootstrap 4 is alpha at the moment but I use it sucessfully with compilers in Wordpress.
When using the fetch method to pull down the css or js files it doesn't prefix the path.
For example if I have an app at:
http://domain.com/HelloWorld
and the webroot is here:
domain.com/html/HelloWorld/App/webroot/
So instead of getting:
/HelloWorld/css/shrink_fd92fc8fcce629a200415826e4b96d9c.css
you get:
/css/shrink_fd92fc8fcce629a200415826e4b96d9c.css
I've followed the instruction below,
bootstrap.php
Plugin::load('Shrink',['autoload'=>true]);
AppController.php
$helpers = array('Form','Html',Shrink.Shrink');
pp/plugin
Shrink folder
but I not sure why am I getting a Error: Class 'Shrink\Lib\ShrinkCompiler\ShrinkCompiler' not found in File D:\home\site\wwwroot\plugins\Shrink\src\Lib\ShrinkType.php.
I've added the class *use Shrink\Lib\ShrinkCompiler\ShrinkCompiler; * in ShrinkType.php. it still showing the error.
Any advise please?
I follow the (simple) installation instructions and when executing the following line:
<?=$this->Shrink->css(['chosen.min.css'],
false, 'link'); ?>
I get these errors:
Warning (2): include_once(ShrinkCompiler\ShrinkCompiler.php): failed to open stream: No such file or directory [APP\Plugin\Shrink\Lib\ShrinkType\ShrinkType.php, line 70]
Warning (2): include_once() [function.include]: Failed opening 'ShrinkCompiler\ShrinkCompiler.php' for inclusion (include_path='.;C:\php\pear') [APP\Plugin\Shrink\Lib\ShrinkType\ShrinkType.php, line 70]
Notice (8): Trying to get property of non-object [APP\Plugin\Shrink\View\Helper\ShrinkHelper.php, line 216]
It will reference a css/shrink_xxxxxxx file, but the file will not have actually been created.
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.