0

I am working with dynamic generated CSS files. To let Apache know, they have to be preprocessed, they have to end with

.php

Now here is the Problem:

Textmate won't discern / differ between *.css.php and *.php. When i set the .css.php file to the CSS MarkUp, my other .php files are also set to CSS MarkUp.

.html files for example, are still MarkedUp by the associated .html-language-preferences defined in the bundle editor.

Is there a way to not completely rewrite the PHP MarkUp definition?

GregorVolkmann
  • 159
  • 2
  • 9
  • I think TextMate only looks at the last file name extension. Which makes sense, because if it's .php, then it's PHP file regardless of any other extensions. Anyway, perhaps you can find an answer on the ##textmate IRC channel on freenode – Flambino Aug 01 '11 at 00:33

2 Answers2

0

I have enhanced the PHP language bundle by:

{
    name = 'css.embedded.block.html';
    begin = '(/\*CSS)';
    end = '(CSS\*/)';
    patterns = ( { include = 'source.css'; } );
},

in the patterns section, but now the CSS code in the .css.php-files have to start with /*CSS and end with CSS*/.

GregorVolkmann
  • 159
  • 2
  • 9
0

If you only have to deal with a few .css.php files you only have to choose CSS in the language menu at the bottom of the window.

If you are able to edit your Apache configuration I'd suggest you add/edit this line (from memory so check the docs before):

AddType application/x-httpd-php .php .css

With this you can have .css files opened normally by TextMate AND processed by PHP as if they were .php.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • But then all the .css files will be preprocessed, that costs performance and time to load... – GregorVolkmann Aug 01 '11 at 11:20
  • Yes, but the performance hit won't be that big and you use a caching layer, don't you? What about choosing CSS from the language menu? – romainl Aug 01 '11 at 19:23