D
D
Dmitry Bay2015-02-28 19:15:05
Less
Dmitry Bay, 2015-02-28 19:15:05

Show on your fingers how to use LESS in YII2?

The bottom line, I installed yii2 basic for tests (in general, I'm perfectly familiar with the framework)
So, a clean installation, I'm trying to find where the legs of .less files grow from.
aha, vendor/bower/bootstrap
Next, I thought I could fix the .less file, and when I change the assets, it will be replaced. But no. This is where I stopped 3 months ago.
Today I found that the less file itself is formed in bootstrap-theme.css.map, and all .less files are written there.
So what should I do to change the .less files and they are written to this bootstrap-theme.css.map file? Or what needs to be done in general to change the .less files, and these changes are implemented on the site in .less files?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-03-19
@kawabanga

As an option:
add an extension like this:
in the config:

'assetManager' => [
            'converter'=> [
                'class'=>'nizsheanez\assetConverter\Converter',
                'destinationDir' => '', //at which folder of @webroot put compiled files
                'parsers' => [
                    'less' => [ // file extension to parse
                        'class' => 'nizsheanez\assetConverter\Less',
                        'output' => 'css', // parsed output file type
                        'options' => [
                            'auto' => true, // optional options
                        ]
                    ]
                ]
            ]
        ],

add your less file to assets and it will be converted to css. The only question left is how to tie it all in bootstrap. Apparently disconnect it from yii and register it explicitly in the form of less files.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question