middleman localizing entire templates not working - localization

I am building a web site using
middleman 3
prototype template extension
en (English language) as default root language
According to this documentation
http://middlemanapp.com/advanced/localization/#toc_6
source/localizable/services.en.html.haml
source/localizable/services.es.html.haml
should generate
build/services.html
build/es/services.html
but bundle exec middleman build generates
build/services.en.html
build/services.es.html
build/es/services.en.html
build/es/services.es.html
I have tried moving both templates to root folder and not working.

According to #rriemann link, the Localizing whole templates does not work bug was reported on Sept 21, 2013 and fixed on Nov 1, 2013.
The issue was closed on Dec 1, 2013.

Related

How to set up angular-cli with Visual Studio 2015 in MVC 5?

I'm looking for some best practices and instructions on how to set up and integrate angular-cli (webpack) with Visual Studio 2015 in MVC 5 (not Core).
I realize there's a similar question asked here (how to set up asp.net angular 2 project using Angular-Cli with ASP.NET Core in Visual Studio 2015?), but that was for Asp.net Core only. My project could not move over to Core yet due to server technical issues.
Here is my solution:
Keep an empty index.html
Run ng build to generate index.html with scripts and styles links injected
Create a Gulp/Grunt task to extract all the scripts and styles links from index.html to a json file say manifest.json.(Here I use Cheerio and Gulp-asset-manifest )
Write logic to read manifest.json and output to your MVC views with Razor syntax
It works perfectly for my ASP.net MVC 5 project.
However it cannot work with route lazy load until publicPath is supported, because the url for chunk js files is loaded from root folder not dist folder.
For example:
The correct chunk js files should be:
www.example.com/MyApp/dist/[id].chunk.js
But it will load from:
www.example.com/MyApp/[id].chunk.js
I already created a PR to add pulishPath for angular-cli to solve this issue.
https://github.com/angular/angular-cli/pull/3285
Update:
The PR for publicPath has been merged, lazy loading is no long an issue.
My approach to integrating Angular/CLI and MVC:
The idea here is to separate the front end development experience from the MVC part, so you don’t have to deal with any of the Visual Studio BS, and enjoy the benefits of the Angular CLI and VS Code.
My app is a hybrid app - most pages and main navigation is classic MVC, but some views are in fact single page applications, where the NG app is embedded into an existing view.
I created a new project in the solution to store the SPAs. (You can exclude this project from the solution build)
In the new project, I created a directory for each SPA. Each one of these folders is a standard CLI project (created using ng new)
Development of the ng stuff is done with VS Code, serving the app using ng serve. The development experience with VS Code is awesome!
When we want to embed the app into the MVC view, we first build it for prod using ng build --prod. This creates the bundles in the dist folder.
In the MVC app, I prepared a folder under Scripts\Frontend for each SPA
A gulp task in the MVC project is responsible for copying the bundles from the SPAs' dist folders into the appropriate folders under Scripts\Frontend. Using Task Runner, the task was bound to to Before Build, so it is automatically executed whenever the app is built.
The important gulp command is:
gulp.src('../FrontEndProj/spa1/dist/*bundle.*')
.pipe(gulp.dest('Scripts/Frontend/spa1'));
of course, you need to delete the existing files etc.
In bundles config, I've created a bundle for the styles and a bundle for the scripts. Since prod bundle names are generated with hash by the CLI, I use wildcards:
bundles.add(new script("~/Scripts/spa1/js")
.IncludeDirectory("~/Scripts/Frontend/spa1", inline.*")
.IncludeDirectory("~/Scripts/Frontend/spa1", "polyfills.*")
.IncludeDirectory("~/Scripts/Frontend/spa1", "vendor.*")
.IncludeDirectory("~/Scripts/Frontend/spa1", "main.*"));
(Note that the order you add the files to the bundle is important!)
bundles.add(
new StyleBundle("/Scripts/spa1.css")
.IncludeDirectory("~/Scripts/Frontend/spa1", "*.css")
In your view, add the ng app directive and use the bundles:
#section head {
#Styles.Render("~Scripts/spa1/css")
}
<app-root>Loading...</app-root>
#Scripts.Render("~/Scripts/spa1/js")
I use a slightly different approach to Chang Liu.
After I run ng build -- prod, I copy the files to the root folder,and change the href attribute in index.html to correspond to my IIS virtual directory.

How can I load up the Todo list app example as part of the asp.net SPA bootstrap template?

I just installed Visual Studio 2013 and there is a link to install web tools 2013.1. On this page, it seems like when you start a new SPA template that you get this todo app as an example but when I create a new SPA project all I get is the regular register and login screen instead of this tool that is listed on the page (screen shot below)
I am not sure if that link is out of date but I can't figure out how to launch this todo list app to start to learn about SPA example.
Am I missing something?
Instead of creating web application from ONE ASP.Net Template in Visual Studio 2013. Create project for Visual Studio 2012 Template. Check below screenshot -
Then in that case you should be getting Todo application by default.

Use Bootstrap 3 RC1 in the New MVC 5

Microsoft has used Bootstrap in their new ASP.Net MVC 5 template. It's really great. However it uses the version 2.3.1 of it and the Bootstrap guys are moving towards the 3 version already. I could just easily rewrite the entire views and the layouts based on the new version but I was wondering if somewhere, someone else has done it (maybe by a long shot the Microsoft folks?).
I know the rules (that I really appreciate) is to put code here instead of link for my blog post but it's just too many small corrections to put them here.
http://www.ghislainproulx.net/Blog/2013/09/using-bootstrap-3-with-visual-studio-2013-aspnet-mvc-template
I have created a NuGet package Bootstrap.MVC.EditorTemplates.Sample that contains a Bootstrap 3 based sample site, plus some additional bootstrap controls and culture-aware validation. This works with the VS 2013 RC MVC5 template.
It uses the Twitter.Bootstrap.Less package instead of the plain bootstrap package, it is best to "uninstall-package bootstrap" from the default MVC 5 site before installing it in the project.
The main idea of making Bootstrap 3 work on ASP.NET-MVC 5 project (or any other server side technology) is to put proper css and js files into the project and make Layout file use these.
This is very well covered in the blog by #Ghislain_Proulx.
Then all you have to do is follow the syntax rules of Bootstrap 3 in your Views.
One way to do it is use straight html markup. Another - use custom helpers. #Maarten has a cool open sourced EditorTemplates of these. However, I'd suggest using TwitterBootstrapMVC as it provides a high level of flexibility.
Disclaimer: I'm the author of TwitterBootstrapMVC and using it for Bootstrap 3 requires a license.
Now that Bootstrap 3 final release is out, and so is Visual Studio 2013 RC and ASP.NET MVC 5 RC, it's confirmed that the RTM of ASP.NET MVC 5 will come with Bootstrap 3 (even though it's not in ASP.NET MVC 5 RC yet).
Until ASP.NET MVC 5 RTM / Visual Studio 2013 RTM, the post referenced in the accepted answer would be the wya to go.

Setting up mvc application on IIS7?

I've created a MVC website using Visual Studio 2010 and would like to deploy it to my newly installed local IIS7. The website works perfectly running from Visual Studio on the development server that it comes with.
Here are the steps I've done:
1) Opened IIS7 Manager.
2) Under Sites created a new site called Foo.
-- I used the DefaultAppPool which is set to .net4 integrated
-- I created a empty directory and used it as the default path
-- I set the port to 54321
3) I then in Visual Studio used the publish button with local IIS and the site set as Foo.
IIS Manager now shows the following under sites:
Foo
bin
content
scripts
views
When I go to localhost:54321 I am given a message saying it can't list the directory. If I put a index.html file in this directory it will launch the file as expected. I guess I'm missing something big here. I published my site to this directory. When I go to localhost:54321 I expected it to launch the index view of the home controller, but it just tries to list the directory.
Found the answer here:
ASP.NET MVC on IIS 7.5
Can't answer my own question cause I have less than 100 points :)
The new server is missing the ASP.NET MVC 3.0. Install it using standalone ASP.NET MVC 3 installer.

Publishing ASP.NET MVC3 Website

This is really confusing me, it just does not want to work. I did exactly like the walk-through on MSDN says and I still get Under Construction page everytime I browse to the domain (fisharwe.com). Ok enough with the nag, here's what I did:
In Visual Studio 2010, I right clicked the project name and chose Publish. I chose to publish to the File System and everything went okey. Then I used CuteFTP to upload the files to the httpdocs folder (Plesk control panel), the live support guy said this is supposed to be the public folder. Finally, I tried to open the site and still nothing shows up... All I get is:
The site you are trying to view does
not currently have a default page. It
may be in the process of being
upgraded and configured.
So what's going on?
Judging by the following response header i'm seeing returned on your domain it seems your running IIS6;
Content-Length 1433
Content-Type text/html
Content-Location http://fisharwe.com/iisstart.htm
Last-Modified Fri, 21 Feb 2003 18:48:30 GMT
Accept-Ranges bytes
Etag "0938ad3d9d9c21:2f56e6"
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
Date Mon, 18 Apr 2011 18:04:19 GMT
Take a good look at this article by Phil Haacked, hope it's helpfull. He explains how to set up an mvc website on iis6
You need to configure the server to send all requests through ASP.Net.

Resources