1

When I generate CSS or JavaScript files using PHP I like to use .js.php or .css.php file extensions. so that I know what's going on.

Is there a way of associating these "compound" file extensions to their respective languages?

1
  • Still have this problem with netbeans 7.0 Commented Aug 5, 2011 at 13:52

2 Answers 2

7

I don't use NetBeans or PHP, but the following trick helped me in a similar setting:

<?php if(0) { ?><script><?php } ?>
# code goes here
<?php if(0) { ?></script><?php } ?>

Simply surround the js code with <script> or <style> tags that don't get rendered. No need to configure any special associations, assuming the editor is smart enough about HTML.

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

3 Comments

dirty hack, but +1, nevertheless
I generate .js files with php, in that case I always forgot to remove <script> :-D
NetBeans 8.1 released, but better solution is not exists still :(
1

What I usually do is condense such "compound" extensions into one, following the tradition of condensing .tar.gz into .tgz.

Comments

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.