Git Product home page Git Product logo

asset-pipeline's People

Contributors

chaseconey avatar d13r avatar dwightwatson avatar eviweb avatar felixkiss avatar fractaliste avatar franzliedke avatar grahamcampbell avatar grrnikos avatar jahvi avatar javichito avatar kdocki avatar kevinklika avatar marsderp avatar pyrello avatar relu avatar samuelcasas avatar serafimarts avatar sillylogger avatar tabennett avatar teeli avatar unnutz 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asset-pipeline's Issues

Cannot compile Bootstrap

Hi, I have Twitter Bootstrap stored under app/assets/stylesheets/bootstrap and I've added the following to my config:

        '.less' => array(
            new Assetic\Filter\LessphpFilter,
            new Codesleeve\AssetPipeline\Filters\MinifyCSS('production')
        )

In application.css I have it set to require bootstrap/bootstrap.less (which contains Bootstrap's imports) but I get 500, Internal Server Error when looking at the console in Chrome. Is there any reason why it can't compile Bootstrap?

support for Sass/Scss Compass CSS3 framework

Hi, I figured out that code written Sass with the Compass framework isn't compiling like it should. It even break sometimes, when there are some specific Compass Sass things used.

Specify which environments should act like production

For example, we have a staging environment in which we'd like to test the production build of our assets. It would be nice if it was possible to define which environments (including 'production') which will compile assets appropriately.

Compiled assets do not use the $directive->add($path);

When using the "local" environment, it generates all the assets I load from different folders/locations correctly, and since I need to load them programatically, I use:

Event::listen('assets.register.directive', function($directive) {

        //Load CSS
        if ($directive->param == './frontend') {
            foreach (BaseController::$assets_css as $path) {
                $directive->add($path);
            }
        }

        //Load header JS
        if ($directive->param == './header') {
            foreach (BaseController::$assets_header_js as $path) {
                $directive->add($path);
            }
        }

        //Load footer JS
        if ($directive->param == './footer') {
            foreach (BaseController::$assets_footer_js as $path) {
                $directive->add($path);
            }
        }

    });

But when running on production, it only reads the files in the folders where the application.js/css are located in, and not the ones that I was registering on the event listener.

In the view I'm loading like this:

<?= stylesheet_link_tag('frontend/application') ?>
<?= javascript_include_tag('header/application') ?>
...
<?= javascript_include_tag('footer/application') ?>

Also I have the assets folder structured like this:

assets
    |--javascripts
        |--footer
        |       |--application.js (//= require_tree ./footer)
        |--header
                |--application.js (//= require_tree ./header)
    |--stylesheets
        |--frontend
                |--application.js (*= require_tree ./frontend)

Then I have various assets in the vendor folder, that I call programatically.

What could the issue be?

Invalid DIRECTORY_SEPARATOR

I do my development on a Windows WAMP machine.

It took me an hour of debugging to work out why CodeSleeve/Asset-pipeline would not work on Laravel 4 and keep generating file not found errors.

Turns out your "DIRECTORY_SEPARATOR" constant is "" - but on Windows it needs to be "/".

edit: ok - i've done some more investigating. It seems "DIRECTORY_SEPARATOR" can be either "" or "/" on windows - both work. But because you are doing a substring() using "", and windows is showing "/" - the substring() fails.

Edit: according to this SO answer - it is easier/better to just use "/" rather than "DIRECTORY_SEPERATOR: http://stackoverflow.com/a/6619053/1317935

Edit: you actually use "/" in some places in your code for the directory seperator anyway.

So I've just replaced "DIRECTOR_SEPARATOR" with " "/" " and it works

Except error when using javascript_include_tag

I get this error when using javascript_include_tag. I haven't actually added any assets as of yet.

Error in exception handler: Cannot find given path in paths: app in /Users/Dwight/Sites/studious/vendor/codesleeve/asset-pipeline/src/Codesleeve/AssetPipeline/SprocketsBase.php:77

Ensure php 5.3, 5.4, 5.5 are working via phpunit

I don't know if php 5.3 is working since I've only tested on php 5.4... so I'd like to test this in other php envs ... want to test using...

.travis.yml

language: php
php:
  - "5.5"
  - "5.4"
  - "5.3"

Create tutorial videos

I want to create some tutorial videos on how to use this thing...

Probably different videos on these topics...

  • Show how it works in dev and production then do getting started, different directories/paths (answer common question about how paths are relative to /assets/ directory) and going over some configuration options
  • Creating your own l4-asset-package (use handlebars .jst.hbs and codesleeve\l4-asset-handlebars as an example and start off of codesleeve\l4-asset-skeleton)

Make asset pipeline work like Rails (sprockets)

This is a pretty huge refactor. Instead of coming up with my own conventions I am going to make this thing work just like rails does where you have sprockets directives which are your manifest inside of your application.js

I will be referencing this https://github.com/Nami-Doc/Sprockets-PHP as a guide.

This will break the master branch of asset-pipeline but I am going to put it on a different branch/version for those using the old way. This way will be much more clean and also introduce JST (just like rails does).

Prefix compiled assets with SHA hash to prevent cache issues

It would be great to have the compiled assets be prefixed with e.g. the first 10 characters of the SHA checksum of the compiled file. This will prevent clients from still using a cached version of the scripts/styles when a new version of the app is deployed.

Example:

assets/application.js will become assets/f1aede3b6c.application.js
assets/application.css will become assets/5d3250e678.application.css

Cannot find given path in paths error

having the above issue on a WAMP server . Using the latest update

Firstly
$this->app['path.base']
print slashes as \ .So wherever str_replace($this->app['path.base'] . '/', '', $this->getFullPath($filepath, $includes) is the $this->app['path.base'] needs to be normalized first then use str_replace

This needs to be done ... atleast in getRelativePath and getRelativeDirectory functions

Secondly,
In getFullPath function in Sprocketbase.php
instead of throw new Exceptions\InvalidPath('Cannot find given path in paths: ' . $filepath) at the end ,I have to return the $filepath as a last resort to get it working.

Without doing the above things I was not able to get this working. I know this is all hacky, but still..

Can you check this?

Pick a license

Please pick a license. Unfortunately nothing is open source by default. My preference is MIT but it's obviously up to you.

Different css asset collections

Does this support different collections of assets?

i.e. I have a "front-end" css collection, and a "back-end" collection for my app. Can I use asset-pipeline for this?

Caching needed for config item?

Should we cache the config item for 'cache' since we are already having to load the config.php for asset pipeline to get 'routing' prefix /assets for the Route::group

Order example Application.js scripts

Is there an example of the standard application.js that is provided where I can see how I have to add just the JS-files I want, in my defined order?

Package specific manifest files

I am opening this issue since I didn't get this info from the docs.
It should be possible to register package specific manifest files directly in the package either from workbench or vendor.
For example in
workbench/vendor/package/src/assets/javascripts/application.js
and
workbench/vendor/package/src/assets/stylesheets/application.css
possibly with the same event-based mechanism used for loading paths and directives.

New asset-pipeline additional assets via composer

Although I don't really favor how rails does this, many people like being able to put a gem 'jquery' (or whatever the asset is) and then install it automatically (via bundler) within the rails asset pipeline.

I need to think about this but I think I can just allow people to register additional paths
(currently only using Config::get('asset-pipeline::paths') but I could add additional paths from other packages that trigger some event handler I setup in asset-pipeline.

So this would, for example, allow someone to maintain a laravel4-jquery composer package which adding this to your compser.json would bring in jquery automatically into the asset pipeline. And in addtional to that they could do manage different branches (for different versions of jquery) so that the user could do something like this in their composer.json

   "require" : {
      "laravel/framework": "4.0.*",
                ...
      "codesleeve/l4-asset-jquery": "1.9"
   }

Then we could just phase out the vendor/assets directory in the structure/ folder of asset-pipeline (I do not really want to maintain assets within this repo, except for what is necessary for codesleeve to function (e.g - needs the initial app/assets setup).

I may just do a bundle of good assets that we use over and over here at work for the first phase of this ... something like 'codesleeve/assets-starter' instead of trying to break it down to just single things like jquery, twitter bootstrap, etc... this will be a good start.

Docs a little confusing

I think your documentation is a little wrong, under the "more on directives" section. You are setting up a stylesheet directive but then use javascript. It was a little bit misleading.

edit: I had a problem implementing this method this but realized I needed to update the code base. Mybad :)

coffeescript extention not changing

I just noticed is that the coffeescripts files extension doesn't change to .js when serving. I have my scipts saved as .coffee extension . Is that intentional?

Also if the original script is of .js.coffee extension instead of .coffee i get CoffeeScript \ Error In test.js.coffee, unexpected YY_TERMINATOR in test.js.coffee:1.

Testing this on dev-testing branch

Turn on/off caching via configuration option in config.php

Since caching is quite confusing for some people, I think it would be beneficial allow developers to control when cache is turned on and off in the config.php

Anytime this value is changed they will have to run a php artisan assets:clean command though to clear the cache because I do not want to load in the config.php on every single asset http GET request (that kinda defeats the purpose of caching somewhat). So this value will get cached.

   'cache' => null|true|false

[Proposal] Multiple stylesheets

Hi, at the moment I'm missing something. A way to generate two different stylesheets. The website itself needs of course a stylesheet, but the CMS behind the website needs another/different stylesheets. That can be done now.

Instructions for pre-processing langs

Hi, I'm using Less, and there doesn't seem to be any instructions on how exactly I can automatically compile a less file and have it served via the asset pipeline. I'd imagine I need to use Assetic or something to help with the compilation process. Please advise, thanks!

assets:generate not available as an artisan command

After installing the composer package and adding the 'Codesleeve\AssetPipeline\AssetPipelineServiceProvider' to app.php, Running assets:generate gives error. And it's not showing up in php artisan list as an available command either.

See:
assets-pipeline-issue

JS files not saved in /assets

Hi, all assets expect the javascript-files are readable by the browser with a direct link.
But the following code gives a 404, because the JS-files don't exist.

<!--[if IE]>
<script src="http://dev.foobar.com/assets/html5shiv.js"></script>
<![endif]-->
<!--[if (gte IE 6)&(lte IE 8)]>
<script src="http://dev.foobar.com/assets/selectivizr-min.js"></script>
<![endif]-->

And is there a way that these files aren't added to the compressed application.js file? Because now they're added to it, but I only want them to be seen for IE-browsers. Like the code above shows.

nginx

location ~ ^/(assets)/{
try_files $uri $uri/ /index.php?q=$uri&$args;
expires max;
add_header Cache-Control public;
}

Prevent/remove asset urls from being added to the session 'url.intended'.

This shouldn't be a problem normally, but I noticed it with a javascript file that was appending scripts to <head> with relative script src paths. This request was added to 'url.intended' session value from the call to Redirect::guest(), so the next call to Redirect::intended() tries to redirect to that asset path.

[Proposal] A better way to compile and serve assets

I was thinking about a better system to deal with assets generated by asset-pipeline, caching and performance for using it in production.

From all your considerations and decisions you made, it seems to me, that performance in production environments is really important to you.

I was listening to Laravel.io Podcast #3 where Taylor, Eric and Ryan were talking about packages that aim to make your life easier while dealing with assets.

Many people, like Taylor himself, stick with using tools like grunt, CodeKit or guard.

These tools are easy to set up, because they just compile the assets to vanilla js/css sitting in your public directory. You can leave the worry about serving them to your webserver. There will be no cost booting up Laravel just to get correct Routing going.

I can see downsides using one of the above methods in

  • losing the flexibility of manifest files
  • losing the ability to write your own filters
  • the need to set up and install yet another dependencies on every developer's machine
  • having to check the compiled files into your SCM, or install the dependencies on the server as well. This means creating noise in your git log by committing the css file, whenever you change the tiniest partial file.

So how about doing it a little different:

In Development

http://foo.dev/assets/some.css still gets served by your Controller. If no app/assets/stylesheets/some.css exists, it will look for app/assets/stylesheets/some.css.scss or app/assets/stylesheets/some.css.less, compile it down to regular css and serve the output.

In Production

For production, the assets get precompiled. Running a php artisan assets:precompile command would be part of the deployment process. It will save your compiled css/js files into public/assets/. Your webserver will happily serve them "as is" โ€“ no bootstrapping Laravel for assets anymore in production (where it really counts)!

That way, I think, there is no potential performance or scaling issue caused by this package (no more than by any other file generated by other tools/methods and served as static files by the webserver), while preserving the flexibility of manifest files, custom filters, and more.

Also, you won't have to install node or ruby on your servers and can keep your git history clean.

Lastly, you won't have to keep getting a headache about crazy caching methods. Your code affects fairly non-critical parts of the software development process (development, deployment), that can spare some milliseconds longer execution time.

Thoughts?

Minify Breaks CSS

Great work with this so far!!!!

But just playing around with with minify I have noticed that it breaks CSS when minifying.

For example I have tried bootstrap 3 example's.

If I use bootstrap minified version and without minify on the page looks correct. Once I turn on minify it breaks the page.

If I try normal bootstrap and without minify all is good. Again turning on minify it breaks the site.

Would be happy to spin up some dev sites to show you!

Update broke assets

After updating composer the assets have broke.

Looking at the docs I can see you just done an update, you have suggested updating to alpha ie,

"codesleeve/asset-pipeline": "alpha"

Getting this error now trying to update.

[UnexpectedValueException]
Could not parse version constraint alpha: Invalid version string "alpha"

Hope you can help. Love what your doing with this. Love the Rails Asset Pipeline :-)

Server Requirements

Hello,

I'm using your package for my project and it's working nicely on my Macbook for dev.
However when I move my project on the production server, the CSS is compiled but I get some weird errors with PhpMin and JsMinPlus.

Are there any dependencies required on the server in order to make it work?

Thanks.

Implement require_self

I've found this to be quite a handy directive, though it's not yet implemented.

Directive 'require_self' has not yet been implemented

I imagine it's already on a list somewhere, but just in case it's not!

use specific versions of dependencies in composer.json

I'm going to use the latest versions of deps in my composer.json but then I will at least have them listed so they don't change. Right now I'm using @dev and dev-master ...

"require": {
    "php": ">=5.3.0",
    "illuminate/support": "4.0.x",
    "kriswallsmith/assetic": "1.2.*@dev",
    "leafo/lessphp": "0.3.*@dev",
    "coffeescript/coffeescript": "dev-master",
    "nitra/php-min": "dev-master"
},

URI rewrites inside of CSS files

Gonna make a filter spin off of the assetic filter which will work nicely with asset pipeline so that css files can have the urls re-written from relative paths to real paths (relative to url:to('/assets/ ...')

Secure Assets

I have just been testing my environment so it uses secure routes but asset-pipeline does not handle secure assets.

time latency per file

Average time taken to load per file is around 1 second for me! does anybody else facing this even on fresh install

Allow register of directives listeners via events

Allow someone to create a directive listener register. This will allow the user to inject in their own files via a laravel event listener. Maybe something like this...

Event::listen('assets.register.directive', function($directive) {
    if (!$directive->isJavascriptManifest()) return;

    if ($directive->name == 'require' && $directive->param == 'jquery') {
        $directive->add('jquery.js');
    }
});
Event::listen('assets.register.directive', function($directive) {
    if ($directive->name == 'awesome_directive' && $directive->isStylesheetManifest()) {
        $directive->add('awesome/stuff1.js');
        $directive->add('awesome/stuff2.js');
        $directive->add('awesome/stuff3.js');
    }
});

Changes to imported sass files are not detected and recompiled

As noted here:

#38 (comment)

If a sass file imports a partial, and you make changes to that partial, Asset Pipeline does not detect the change and recompile the asset(s). The workaround is to instead register the partials in the manifest or manually update (change timestamp) on one of the sass files in the manifest.

It's not a huge issue, but it would be nice if things worked as you'd expect them to. Short of a fix, a note in the documentation might be in order.

404 in production mode when main CSS is a LESS file

I've come across an issue where if your main CSS file (application.css) is instead a LESS file called application.css.less with require_self, it doesn't compile properly in production and instead 404s.

The workaround I'm using is to move all my LESS styles to another stylesheet and then require it using the Sprockets format, but it doesn't seem as this should be a problem to start with.

depth first sort for 'require_tree' directive

I have my JS in the following file structure:

javascripts/jquery.js
javascripts/jquery/ui.js
javascripts/jquery/ui/timepicker.js
...

When I require_tree jquery it loads:

javascripts/jquery/ui/timepicker.js
javascripts/jquery/ui.js

That means timepicker.js fails because it depends on ui.js methods. I think this file structure works pretty well for organizing dependencies... it works out of the box in Rails. Open to a pull request?

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.