assetic

Assetic files in symfony are behind the firewall?

守給你的承諾、 提交于 2019-12-07 04:42:38
问题 I have simple login page and security set up like this: firewalls: main: pattern: ^/ form_login: provider: fos_userbundle csrf_provider: form.csrf_provider use_referer: true always_use_default_target_path: true default_target_path: / logout: true anonymous: true access_control: - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/, role: ROLE_ADMIN } And in my

Vagrant, shared folder: take advantage of inotify over NFS

微笑、不失礼 提交于 2019-12-06 19:10:34
问题 Our Symfony2 webapp uses the Assetic watcher in development mode to re-compile assets on the go. The webapp runs in a Docker container which runs in a Vagrant VM (Ubuntu 12.04 Precise). The host is OSX 10.9 Mavericks and it shares the code folder with the VM through a NFS (v3) share and the code is mounted in the container via a host/guest volume in Docker. Since inotify seems to not be able to detect file modifications over NFSv3, the watcher works in polling mode which can be very slow (~1

500 error when compiling scss in symfony2

匆匆过客 提交于 2019-12-06 12:34:25
I am getting a 500 error when compiling scss files with assetic. Strangely enough, using php app/console assetic:dump the scss compiles without issue. Resources in web/bundles are relative symlinks. I'm running OSX 10.8, symfony 2.3, and php 5.4.20. config.yml # Assetic Configuration assetic: debug: %kernel.debug% use_controller: false bundles: [ ] filters: cssrewrite: ~ sass: apply_to: "\.scss$" base.html.twig {# ... #} {% stylesheets filter='cssrewrite' 'bundles/acmehello/css/main.css' 'bundles/acmehello/scss/page.scss' %} <link rel="stylesheet" href="{{ asset_url }}"/> {% endstylesheets %}

Loading resources conditionally with Assetic

喜夏-厌秋 提交于 2019-12-06 12:00:51
Is it possible to load assets conditionally with Assetic? For example (peusocode): load resource1.js load resource2.js if condition = true load resource3.js endif output combined.js No it's not possible because assetic files are compiled on the server side, so assetic don't have access to the value of your variable at runtime. A solution could be to add a second assetic tag // the first assetic tag {% if condition %} // an other assetic tag {% endif %} Nicolas I came across to exactly the same problem. As julesbou already mentioned, it is necessary to add several assetic tags. My particular

In Symfony2 how can I append a date to the assetic filenames

戏子无情 提交于 2019-12-06 05:43:20
I'm using assetic with symfony and I'd like to append a timestamp or date string to the end of the filenames it creates. The purpose of this is to have more control over browser caching, so every time I run assetic:dump, all my compiled assets will have a new file name and users browsers will download the new file. Is this the best way to prevent browsers using old (cached) asset files? If it is, how do I append the timestamp to the filenames? I suggest, in order to have control over browser's cache, do the following: app/config/config.yml framework: templating: assets_version: %assets_version

Serving relative images using assetic

爱⌒轻易说出口 提交于 2019-12-06 03:36:31
问题 I'm trying to understand symfony2 assetic bundle. I'm trying to use a jquery plugin which uses it's own css file. I've put everything in mybundle/Resources/public and then split into images/ javascript/ and css/ The plugins css is using relative paths to get the images like ../images/sprite.png Using assetic to serve the css file: {% stylesheets '@MyBundle/Resources/public/css/mycss.css' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} The path generated by assetic is

Creating a ready-to-use symfony 2 application zip

こ雲淡風輕ζ 提交于 2019-12-06 03:33:35
问题 I have created a symfomy application bundle that can be used to collect crash reports from Android applications (for those interested in Android and ACRA: https://github.com/marvinlabs/acra-server). People who are ok with that can simply install that application as a regular Symfony 2 bundle, by getting it from GitHub and doing all the command line stuff that is needed BUT I want people to be able to install that application very simply and without: any knowledge of symfony requiring access

Static asset dumping with png optimization references wrong files

隐身守侯 提交于 2019-12-06 02:02:30
I'm trying to build a project using Symfony2 and all possible optimizations included. One of such is the optimizing of images used in the html. Symfony2 has a bundle Assetic that allows for this using e.g. optipng right from the Twig templates. The docs are here: http://symfony.com/doc/2.0/cookbook/assetic/jpeg_optimize.html The problem i'm having is that everything works in the dev environment (where all assetic assets are served through a controller) but that the CLI command dumps to a file, not used in the rendered templates. This is the output when dumping the assets, the files are

Using Twig as an Assetic filter for JavaScript in Symfony2

有些话、适合烂在心里 提交于 2019-12-06 01:43:38
Is there a way to use Twig as an Assetic filter? What I want to do is have Twig parse my JavaScript files as Twig templates, and then pass them to Assetic so that they get combined and minified in production. You might be scratching your head thinking why I would want to do this in the first place, so let me jump to an example. I am making a game engine in JavaScript and I need to have two versions of several 'classes'. One version for the user and another for the editor. An example of one of these classes would be the singleton World . The user version of this class might look like this: var

Assetic files in symfony are behind the firewall?

家住魔仙堡 提交于 2019-12-05 10:39:03
I have simple login page and security set up like this: firewalls: main: pattern: ^/ form_login: provider: fos_userbundle csrf_provider: form.csrf_provider use_referer: true always_use_default_target_path: true default_target_path: / logout: true anonymous: true access_control: - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/, role: ROLE_ADMIN } And in my base.html.twig file I have {% stylesheets '@BrStgCcBundle/Resources/public/css/bootstrap.css' %} <link