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">
#RenderPage("~/CSS/_ExportStyles.min.css")
</style>
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.
So, it turns out that #RenderPage is not what I was looking for...
what I needed is this:
#Html.Raw(File.ReadAllText(Server.MapPath("~/CSS/_ExportStyles.min.css")))
Related
I am trying to practice some web development with a simple HTML file and some external styling. I have my HTML and CSS files saved in the same folder, and am attempting to link the CSS to my HTML file. When I go to view the page, none of the styling is applied. There is a file called "styles.css" loaded into the sources tab, but it just looks like my HTML file. The HTML included is from the file I want to link by the name of the file in the sources. You can see the link attempt (I've tried with and without specifying type, and I've tried putting a slash in front of the name of the file), and you can see the file included in sources:
I've looked at each element, I've looked at the computed styles, and nothing suggests that the file is properly loaded. I've looked through several questions and most of the solutions are things I've already tried. Thanks!
Make sure the index file is saved as a .html file.
If it's still not working try href="./styles.css"
try writing href="./style.css"
I work on a project where I only have access to the text editor in CMS, so I create HTML files on local and copy the piece of HTML(content area), CSS and scripts to the CMS editor, is there a way I can use maybe node.js and set up something that can build a file with merged CSS and HTML(content are only) every time I make a change to CSS or HTML.
grunt-processhtml was the answer, I was able to combine CSS, chunk of HTML and JS into one file using this.
I am relatively new to freemarker and I am trying to convert a .html file, that displays correctly, to a .ftl file.
The conversion of the main part of the web page went great (all the elements are there), except for the theme (background) of the web page. It doesn't display, but it was in the html.
My theme is just a link that points to a .min.css file.
<link rel="stylesheet" href="../static/themes-dist-4.0.27-theme-gcwu-fegc/theme-gcwu-fegc/css/theme.min.css">
I am trying to understand if you can pass "html to ftl" straight?
Also, can you display a theme in a ftl file?
EDIT:
The answer to this was to put the file into a public directory (ressources/public/themes/*). The compiler picked it up from there.
You might need to understand that FreeMarker template files are executed on the server, and the browser just sees the output as regular HTLM. Thus, you can simply rename a .html to .ftl (or rather to .ftlh), and since it contains no FreeMarker directives, that template simply prints the original HTML as is.
Check on the developer panel (usually opens with F12) of your browser if the CSS file was successfully loaded. The CSS file is (usually) not a FreeMarker template, just a "static" file, so it's unrelated to FreeMarker (though of course it can also be generated by FreeMarker if you need dynamism there).
For most of my project's documentation I prefer a standard sphinx layout. However for the landing page I would prefer to use custom HTML/CSS/JS without any of the layout, TOC, or sidebars of the normal sphinx site. Is there a way to include a raw HTML standalone page in a sphinx-generated website in a way that completely disregards the normal layout of the rest of the site?
As a counter example I know that I can include raw HTML bits into a page using the following (see also this question)
.. raw:: html
:file: myfile-html
However this just embeds a file within the normal layout. I would like to have a completely standalone HTML page.
I just ran into this problem myself, and the way I solved it was to simply include the html file in my source/_static folder, then refer to it with a relative link.
So if source/_static/my_standalone.htm is the path where I have my non-generated HTML file, and the .rst file where I want to type my link is at source/otherfolder/index.rst, I write it like this in my rst:
Link to my non-Sphinx HTML file
===============================
To get to my standalone, non-generated HTML file,
just `click here <../_static/my_standalone.html>`_ now!
I know this may be a stupid question, im newer to this.
My menu bar takes over 1,000 lines in my html file. My client wants his index.html file organized so he can edit himself if needed.
I want to know if i can put my html for my menu in another files for instance in a file called : menu.html
and link in my index.html file by
<link href="../files/menu.html " type="text/html">
or in any other way that would work?
if you are using any programming language, use its code. For example, if you are using php
use
include_once('../files/menu.html');