I'm using Symfony version 2.3.1 and SmartyBundle version 1.2.0.
I followed the steps 2.3 and 2.4 at https://smartybundle.readthedocs.org/en/latest/installation.html.
But as soon as I enable SmartyBundle in AppKernel.php, I have this error in app/console:
You have requested a non-existent parameter "assetic.use_controller".
Here is an excerpt of my config.yml:
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
I had this same problem.
You need to make sure that the SmartyBundle appears after AsseticBundle in AppKernel registerBundles
Related
I'm working on a Symfony 3.4 application. Assetic bundle wasn't installed, so I made :
$ composer require symfony/assetic-bundle
and add it in the appKernel.php :
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
It worked perfect. Then, in my app/config/config.yml, I added :
# app/config/config.yml
assetic:
debug: '%kernel.debug%'
use_controller: '%kernel.debug%'
filters:
cssrewrite: ~
# ...
and now my front-end is no more available, this is the error displayed with app_dev.php :
ParameterNotFoundException You have requested a non-existent parameter
"templating.engines".
Even if I remove the Assetic configuration out of the config.yml the error is here. I have been searching in all my *.yml files I do not find any property "templating.engines" .... any idea ?
Try adding the following in the config.yml
framework:
...
templating:
engines: ['twig']
there is no real detail in the documentation about the AsseticBundle Config - in config.yml.
assetic:
debug: "%kernel.debug%"
use_controller:
enabled: "%kernel.debug%"
profiler: false
read_from: "%kernel.root_dir%/../web"
write_to: "%assetic.read_from%"
java: /usr/bin/java
node: /usr/bin/node
ruby: /usr/bin/ruby
sass: /usr/bin/sass
# An key-value pair of any number of named elements
variables:
some_name: []
bundles:
# Defaults (all currently registered bundles):
- FrameworkBundle
- SecurityBundle
- TwigBundle
- MonologBundle
- SwiftmailerBundle
- DoctrineBundle
- AsseticBundle
- ...
assets:
# An array of named assets (e.g. some_asset, some_other_asset)
some_asset:
inputs: []
filters: []
options:
# A key-value array of options and values
some_option_name: []
filters:
# An array of named filters (e.g. some_filter, some_other_filter)
some_filter: []
workers:
# see https://github.com/symfony/AsseticBundle/pull/119
# Cache can also be busted via the framework.templating.assets_version
# setting - see the "framework" configuration section
cache_busting:
enabled: false
twig:
functions:
# An array of named functions (e.g. some_function, some_other_function)
some_function: []
I'm specially interested in
read_from: don't understand the path, too
write_to:
because I don't really understand how to use it.
So, I want to use SCSS and Compass and I have an folder in AppBundle/Resources/assets/styles/main.scss
What I have to setup in the config.yml, that assetic know how he find the main.scss as a global setting?
Unless you are trying to update the directory from which Assetic reads/writes (thus being /web by default), you don't need to change anything here. The configuration can be understood from a good part on the Symfony documentation. You'll find what you need in:
read_from: "%kernel.root_dir%/../web"
write_to: "%assetic.read_from%"
These are paths to a directory which is writable/readable, and exposed to the public. In this case, it means it will look for /path/to/app/../web for both readings and writings.
In a general manner, check for php app/console config:dump-reference X to find the default configuration of a given bundle, where X is the bundle config name. In your case, try the later: php app/console config:dump-reference assetic
Now, what you want is to use compass/sass from your view as far as I can see.
In your twig file, put the following:
{% stylesheets 'path/to/main.scss' filter='compass' %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}
After adding the configuration for compass if it needs to be tweaked, you should be all set.
Is it helping? it not, could you please provide more details?
I am using assetic to manage my CSS files in the Symfony 2 framework. It works well in production mode.
My problem is that in debug mode, assetic keeps combining my files into one output file. It makes it difficult to track a particular CSS style. Plus the combined file is not always updated.
How can I disable this feature in debug mode ?
Edit: Here is my call to assetic:
{% stylesheets filter='lessphp,cssrewrite'
'#DevoptionBaseBundle/Resources/less/front.less'
'#DevoptionBaseBundle/Resources/less/back.less'
'#DevoptionBaseBundle/Resources/public/css/custom-theme/jquery-ui-1.10.0.custom.css'
'#DevoptionBaseBundle/Resources/public/css/jquery.mCustomScrollbar.css'
output='css/style2.css'
%}
There is a configuration for Assetic
In your config.yml, you should have
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
which means that you have to dump the assets in order tu use them.
And in your config_dev.yml, you should have
assetic:
use_controller: true
which means that the assets are loaded each time. You should check this configuration in your config_dev.yml
I'm having problems trying to activate the SoftDeleteable filter in StofDoctrineExtensionsBundle. I configured it as described in the manual:
# app/config/config.yml
doctrine:
orm:
entity_managers:
default:
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
But this is what I get:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options "filters" under "doctrine.orm.entity_managers.default"
Running bin/vendors update didn't help. What could be wrong?
First, using bin/vendors update is a bad idea because it sets all the vendors to their latest versions. You should use bin/vendors install only.
Second, make sure you are using the 1.0.x branch of StofDoctrineExtensionsBundle, because the master branch is not compatible with Symfony 2.0.x.
You can just do it yourself, it is not hard, saving you from installing another bundle:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/filters.html
I'm having trouble with setting up my Symfony2 production environment. The dev environment through app_dev.php works fine, but production through app.php leades to a 500 Internal Server Error, and this message in the Symfony error log:
[2011-08-28 10:09:11] request.CRITICAL: Symfony\Component\Config\Exception\FileLoaderLoadException: Cannot load resource ".". (uncaught exception) at /var/www/Symfony/vendor/symfony/src/Symfony/Component/Config/Loader/Loader.php line 75 [] []
Don't know how to solve this, or even stack trace it...
Happened to me when I updated the Liip/ImagineBundle.
In older versions of this bundle it required this in your routing:
_imagine:
resource: .
type: imagine
In the new versions this is to be replaced by:
_liip_imagine:
resource: "#LiipImagineBundle/Resources/config/routing.yaml"
So in my case the problem was I updated the bundle via composer, but did not update the routing.yml.
I had the same problem. Try to add:
assetic:
use_controller: true
in /app/config/config_prod.yml and clean cache after that (rm -fr /app/cache/*)
if you have these problems in production environment and you use assetic, then check if you don't have this:
_assetic:
resource: .
type: assetic
in your config file (normally this is in config_dev.yml only, not in production)... in other case try to check other routes with resource: .
I had faced a similar issue while hosting symfony2 project to a godaddy windows shared hosting with php5.3 support and fixed it by providing write permission to the symfony2 directories and creating an iis virtual directory for the symfony project directory.
For me this was caused because I wasn't sure where a blob of config was added to my config.yml and removed it because I didn't know what it did :)
So I downloaded a fresh copy of symfony2 and realized that the blob of code comes by default on a fresh install, so I put it back in and it all works. Here's what I had removed and I fixed the problem by putting it back in:
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
then answer is in the routing.yml
there is a resource in there that was probably disabled and the reference is left.