Override textmate language code coloring
With a little bit of help from htaccess I managed to开发者_如何学C incorporate php inside my css documents. The problem with this is that textmate sees that the document has php tags and color coordinates that language over css. Is their anyway to switch back and forth manually (without removing php and saving the file)?
You can manually change the language of a file using the drop-down menu at the bottom of a document window. This crudely annotated screenshot shows where:
What is the extension of your file? .php or .css?
What does the language-selection menu at the bottom of the window says about your file? PHP or CSS? What happens if you change one for the other?
How is your file? <?php ... all your css ... ?>
or body { background-color: <?php echo $todaysBgColor; ?>; } ...
?
TextMate's theming is build around the notion of scope. If your file looks like my first example, there is a big chance all the CSS parts that you put inside of a PHP block are going to be treated as PHP by TextMate because of their scope.
I don't remember the keyboard shortcut but there is a command in the theme-creation bundle that shows you the scope of the word/character under the cursor. Write it down, then go to the Preferences window and edit your theme so that a CSS scope within a PHP scope looks like normal CSS.
精彩评论