0

How can I enable recognizing and highlighting of PHP-code in CSS files in PhpStorm?

The files are named *.css and not *.php. I cannot change them (restriction/dependency on the environment/framework).

I'm aware of the possibilities of Highlighting js-code inside php file, but this requires the extension to be php which isn't possible.

1
  • 2
    So ... change extension to complex one: *.php.css and register to PHP files in Settings | File Types; then -- as described in that link for js files. PhpStorm has to recognize such files as PHP ones in order to have PHP highlighting, and the only way of doing this is to assign some pattern to "PHP files" (can be file extension(s), can be full file name etc) Commented Apr 24, 2013 at 8:50

1 Answer 1

4

Just assign CSS extension to php file type and then set the "outer" language to CSS at Settings/Template Language for all those files.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 also, if you don't want to have all .css files to be treated as PHP, but be more specific; the file patterns in PhpStorm accept wild cards, for example myprefix-*.css will probably work as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.