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 rotate multiple words with CSS?

    CSS - HTML - How to align images properly across the page

    How to locate Element via CSS Selector/XPath?

    How to get a css animation to transition quicker in keyframes

    How to create a “dot-dash” border with css or javascript?

    How to create a template that will show only in IE6 using javascript?

    How to refer to css file in codeigniter? 2.0

    How to apply different css style for IE 10 and 11 only?

    How do I overlay a div on an empty div containing a background image?

    How to show list items in menu when hover on the parent's it via CSS? [closed]

    How To Add CSS & JavaScript Into Windows Form Application

    how to handle spanish character for classname in CSS file?

    How to implement a web page that scales when the browser window is resized?

    How to Override/Undo CSS Class Attributes for Twitter Bootstrap

    How can you fix the height of an element in IE 6, and allow hidden content to be scrolled into view?

    How can I build a dynamic menu using CSS and JavaScript?

    CSS Transition - how to make a text coming from the top side?

    How to make text in transparent div opaque? [duplicate]

    How are these sites implementing their onhover overlays?

    How to get tr:nth-child which has css applied

    how to make full css container

    how to get rid of firefox image border

    How to make diagonal div

    How to add visual indicator of focus for Radio Button for Firefox

    How to change Kendo Excel Button Content Text

    How to simulate 'position:fixed' behavior on Flexbox-aligned sidebar

    How to access an element's class value via CSS

    How do I vertically align the text to the middle using CSS?

    How not to mess up styling when using css frameworks

    HTML, CSS: How to override settings from *{}(!important is not working) [closed]