How to use @RenderPage to include CSS content inline - MVC Razor

Tags: html,css,,razor

Problem :

I am currently exporting a page from my project into Excel which will not allow the linking of external content e.g. external CSS.

What I am trying to achieve is a simple way to include a CSS file in my view but to have it called directly from a CSS file which will have automatically been minified by Visual Studio.

So, in my view I have tried this:

<style type="text/css">

but doing this returns the following error:

Server Error in '/' Application.

The following file could not be rendered because its extension ".css" might not be supported: "~/CSS/_ExportStyles.min.css".

What I know will work would be to place the CSS in a normal .cshtml file and include that, but I would lose the ability to ".min" the file which keeps the file size small and allows me to automatically strip out comments etc.

Solution :

So, it turns out that @RenderPage is not what I was looking for...

what I needed is this:


    CSS Howto..

    How to override PrimeFace CSS to customize my button?

    How To create slider/toggle to change font size on screen with HTML CSS JS [closed]

    How to do aspect to fill in img tag?

    How can I make the first letter push itself into the paragraph like a newspaper style

    how to make sure that that grid layout row adjusts the height automatically as per content

    How to get bean property on css file?

    How to vertically align div containers with CSS?

    how to stop only the hover pointer event in css

    section to be trigger of show/hide content by click html/css only

    how to achieve this effect with css html?

    How to order rows (or divs) vertically using blueprint css?

    How can I add a default to my CSS slide show banner?

    How to adjust the application with equal resolution in different browsers? [closed]

    How to achieve this awesome CSS animation

    How can I show an attribute as text with CSS?

    CSS - How to break a line only at division borders

    how to set height of a 'td' inside a array in javascript using CSS

    How to identify is a blog post has been selected or not?

    How can I make my div's svg background image scale dynamically and stay in the center of the div

    how to put css max-left or min-left position to absolute object?

    How do i put text under an img icon in a menu?

    How can I fill with the color and make it square using CSS?

    How to customize twitter/bootstrap more deeply? [closed]

    How to specify a html tag on a LESS CSS nested class?

    css - how to add another div above one with 2 colums layout?

    How to create a darker background on a whole page with one new div

    How do I organize imports in Compass/Blueprint?

    How to get rid of scrollbars around iframe

    How to link CSS file from css folder in wordpress

    How to make the underlines the same size in all browsers with css?