Android Assets with sub folders

Edit: was wrong about subfolders. This code works just fine on 1.5 (for a file sample.txt placed under sub folder in assets): InputStream is = getAssets().open(“sub/sample.txt”); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while ((line = br.readLine()) != null) { Log.e(“wtf”, line); } br.close(); Are you sure you’ve got the names right? … Read more

Route helpers in asset pipeline

UPDATE: Now there is a gem that does this for you: js-routes The problem is that Sprockets is evaluating the ERB outside of the context of your Rails app, and most of the stuff you’re expecting isn’t there. You can add things to your Sprockets context like so: Rails.application.assets.context_class.class_eval do include Rails.application.routes.url_helpers end That’s all … Read more

Include assets when building angular library

As already said, angular library now support assets since the v9.x of angular. But it isn’t well explained on their website. To make it work you’ll have to: Add an assets folder at the root of your library project Add “assets”: [“./assets”], into the ng-package.json file of the library { “$schema”: “../../node_modules/ng-packagr/ng-package.schema.json”, “dest”: “../../dist/icon”, “assets”: … Read more

How to load a image from assets?

You can follow my tutorials on displaying data from Assets: https://xjaphx.wordpress.com/2011/10/02/store-and-use-files-in-assets/ The sample with loading image and text to display. I now added the relevant part of the provided link (in case of earthquake or something) 😉 Taifun // load image try { // get input stream InputStream ims = getAssets().open(“avatar.jpg”); // load image as … Read more

Symfony2 – Assetic – load images in CSS

use the cssrewrite filter from Assetic bundle In config.yml: assetic: debug: %kernel.debug% use_controller: false filters: cssrewrite: ~ And then call your stylesheets like this: {% stylesheets ‘bundles/cmtcore/css/*’ filter=”cssrewrite” %} <link rel=”stylesheet” type=”text/css” media=”screen” href=”https://stackoverflow.com/questions/7044631/{{ asset_url }}” /> {% endstylesheets %} Oh and don’t forget to use php app/console assetic:dump