Question: I am writing a css/js page that has some dynamic parts in it.
To do this i am using a cshtml file containing css/js - i am using mvc.net and returning the css from a controller action.

The trouble is visual studio recognizes this page as html and not as javascript/css so it does not give me javascript/css coloring and IntelliSense.

My questions:

1. is there a better/easier way of creating dynamic css/js in .net
2. How can i get visual studio to recognize a cshtml page as javascript.

Answer: 
I know this is an old post...but...

What I did was just put the script tags around my javascript files in their own .cshtml file. 
I created a separate controller (JavascriptController.cs), and I created a filter on that controller that removes the script tags. I set the filter in the OnActionExecuting method. by just doing

```
this.Response.Filter = new ScriptFilter(Response.Filter, Response.ContentEncoding);

```

So you get the syntax, you get razor without having to use RazorJS, and you can request the js files like regular routes in an MVC application. You just have to keep the script tags on the partial view while editing. 

So you can call 

/Javascript/{Action}

and you'll get your javascript file with your razor in it, and the filter will remove the script tags so you can include it like a normal script.

```
<script src="http://{host}/Javascript/{action}"></script>

```
The best solution is to follow unobtrusive javascript and unobtrusive styling and put your javascript into a `.js` file, put your css into a `.css` file and reference them in the markup in your cshtml file with a `<script>` and `<link>` tag.

e.g.

```
<script src="Scripts/scriptName.js" type="text/javascript"></script>
<link rel="stylesheet" href="Content/styleSheetname.css" type="text/css" />

```

This is good practice as it keeps your content(markup)/styling/behaviour separate.