Giter Site home page Giter Site logo

trentrichardson / cakephp-shrink Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 9.0 216 KB

Shrink is a CakePHP plugin to Compile, Combine, Compress js, css, less, sass, coffee assets

PHP 90.61% CSS 6.36% CoffeeScript 0.73% JavaScript 1.67% TypeScript 0.64%

cakephp-shrink's People

Contributors

trentrichardson avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

cakephp-shrink's Issues

About Contributions

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

SCSSPHP not finding imports

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.

Plugin isn't Minify .js files in CakePHP 3.0.3

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';

Cannot get files from plugin loaded with bootstrap

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

ShrinkHelper.php path fix

$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')));

Fatal error: Call to undefined method ShrinkCompilerScss::run()

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?

Plugin path error

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

Parse Error compiling Boostrap 4 - _variables.scss

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.

Fetch doesn't work for subdirectories

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

Error: Class 'Shrink\Lib\ShrinkCompiler\ShrinkCompiler' not found

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?

Can't find ShrinkCompiler? (CakePHP 2.8.4)

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.

  • I do see ShrinkCompiler.php in its proper folder, all I did was extract.
  • Does the same thing for .less, and any other CSS and JS files I have

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.