How to change script or style files location from nuget? - asp.net-mvc

I have a MVC project and I am using jquery, bootstrap and some other files from nuget. In mvc by default all of scripts files is in Scripts and all of css files is in Content as you know. I moved all scripts and css files to Content/css , Content/js , after that i got a problem because the files are going to the default location (js => Scripts, css=> Content) when i update my nuget packages.
So how can i solve this problem ? Is it possible ?

In NuGet it is not possible to control where content files get installed to. The author of the NuGet package decides entirely what path to use for content files.
Instead of using NuGet for content files, I recommend using Bower, which is based on npm (the Node Package Manager).
With Bower you can control where files get installed to. Check out this SO post on the subject (especially the second answer): How to change bower's default components folder?
More info on Bower:
Getting started with Bower: http://blog.teamtreehouse.com/getting-started-bower
Bower support in Visual Studio: http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx

Related

Correct way to deal with downloaded d.ts files from DefinitelyTyped when installed via npm

Visual Studio 2017 Enterprise
ASP.NET MVC Application
TypeScript 2.5 SDK
Source control is in TFS
I am using Microsofts built in property editor instead of a custom tsconfig.config file:
To allow an easy workflow I am using Mad's Kristensen's Package Installer to do my NPM installations of Definitively Typed TypeScript definitions within my MVC web project.
Ultimately this ends up creating node_modules in a folder under the solution path:
While I could use this SO post to do a GLOBAL install using -g --prefix so that I could place this into a folder of my choosing say:
MVCProjectFolder\TypeScript\Npm\Modules
I have some concerns or at least a request for a better way.
So my questions are:
Is there a different way to changing the node_modules folder from within Visual Studio without specifying -g -prefix
What is the best approach to bundle all the TS generated JavaScript in the project? (The TypeScript Build property option "Compile JavaScript output into file" appears to have no effect)
Do I only need to include the d.ts tiles in TFS so that the following will keep on working when synced?
--
/// <reference path="../../node_modules/#types/jquery/index.d.ts" />
/// <reference path="../../node_modules/#types/handlebars/index.d.ts" />
Answer your TFS part, you don't need to check in node_modules folder to TFS. When you want to build your project in TFS, add a nmp task in your build definition:
https://learn.microsoft.com/en-us/vsts/build-release/tasks/package/npm

Grails 2.3.x lib directory with customized plugins

I'm not sure how to ask this question, but I'll try anyway. I found different people having some kind of similar problem. But none with the exact same issue.
I have a grails 2.3.x application, it uses a customized version of a plugin. I'm use to old versions of Grails (pre-Maven dependency resolution), when we were able to include the customized version of the plugin into the /lib folder. I'm doing the same thing, but I am not able to solve anything. :(
Is there a way to tell grails, that lib directory (or some other, into the project folder) have the plugin zip file on it as we were use to?
UPDATE
Just to clarify. I want the packaged plugin into the project directory, not the source code.
UPDATE 2
Try to add the packaged plugin into plugins folder inside project root without any luck. While BuildConfig.groovy have the dependency declared or not.
Not sure if I have understood your question correctly. It seems you want to use a customized version of a plugin in your grails-app. You can do so by creating a "custom-plugins" folder in the root of the application and placing the custom version of the plugin inside this folder. Then in the BuildConfig we can specify the plugin location at the beginning of the file like this:
Assuming I have
myGrailsApp/custom-plugins/custom-plugin-1
grails.plugin.location."custom-plugin-1"="custom-plugins/custom-plugin-1"
That is it.
If you package the plugin as a .zip file and put it in a plugins directory in the root of your application, it will be loaded from there. You might also need to remove the plugin dependency declaration from BuildConfig.groovy before this will work.

Asp.net MVC 4 bundling generation of .min files

I use bundling for some .css files in my solution. I have noticed that when I run the solution in "release" mode (with debug="false" in web.config) a .min file is created, if not existing, for each file included in the bundles.
I have made some modifications in Bootstrap.css, and the only way to see these modifications in the minified file (bootstrap.min.css) is to remove it and then to run the solution with debug = "false".
Is there another way in Visual Studio to automatically regenerate the .min files?
EDIT: I was wrong, running the solution with debug = "false" does not automatically create a .min file if it does not exist. So the question is: how can I update the .min files in Visual Studio?
Have a look at http://vswebessentials.com/. It is a VS Extension for helping with web development.
It will minify your css and js files. Bundling won't re-minify already minified files so you should be OK.
I'm using Mads Kristensens Bundler & Minifier and think it is very easy to install and use.
The bundleconfig.json file can be configured to automatically bundle and minify on build in Visual Studio or you can minify manually by right clicking the css file.
More info and download link:
https://visualstudiogallery.msdn.microsoft.com/9ec27da7-e24b-4d56-8064-fd7e88ac1c40

NuGet satellite package not added to the lib of the main package

I'm trying to create a nuget package for the localization of another package, and I'm following the satellite package approach.
I'm pretty sure to have followed these rules strictly, and the naming conventions as well, but as I download the satellite package from my nuget repo server, it's not adding the expected /it/ folder under the /lib/ folder of the main package.
The main files structure is the following
/lib/net45/myfile.dll
and the satellite package has
/lib/net45/it/myfile.resources.dll
I tried everything, and I double check my packages configurations with the AspNet.Mvc.5.1.1 package and its satellites. They're the same...
I'm wondering if the problem could be on the NuGet server (but sounds weird to me)?
The server version is v2.8.50126.400
UPDATE
So it really seems to be the Server, as if I use a local path (C:...) as repo source, the packages act as expected.
Anyway I've just used the NuGet.Server package to create the server, there's some particular configuration I missed?
The problem was the NuGet.Server .
There's a field missing during the serialization of the feed, the Language, that's why the official packages are working: on the official server the Language field IS serialized, that allow the NuGet client to move the resource assembly to the right folder under the main package's lib folder.
But on a private repository built with the NuGet.Server package this field is just missing.
I've applied a pull request on Codeplex, for the ones who have the same issue.
https://nuget.codeplex.com/SourceControl/network/forks/tanathos/nuget/contribution/6524

What relevance do folders have in a dart project?

When I create a sub folder in a Dart Project in Dart Editor, immediately a package subfolder is created inside this sub folder. I have not read anywhere that sub folders have a special meaning for the project structure, but it appears they do. Anybody knows more?
The package subfolder holds symlinks to your Pub packages. You can read more about Pub and Pub packages at http://pub.dartlang.org/doc/.
When you start a non-web project, the editor will automatically create package directories in your bin/ and test/ directories (but not in your lib/ directory). If you create a web project, a package directory is also created in the web/ folder.
If you add a Pub dependency in the pubspec.yaml file and run pub install, your will see that the package folders will contain symlinks to the Pub package you just installed. If you are using Dart Editor, pub install will automatically run once you modify your pubspec,yaml file.
If you create a subfolder inside any directory that contains one of these auto-generated package folders, the subfolder will get its own package directory. This way, you will have access to your Pub packages no matter how deeply you nest your code in a directory.
Shailen's answer is correct. I wanted to add a bit more, as the title of this question is "What relevance to folders have in a Dart project?"
Dart is designed to be very web friendly. Because there is no load path or classpath on the web, Dart apps must run without requiring an installation or pre-configuration of a local environment.
The only way you can link one file to another in Dart is via a URI. These URIs can be file URIs, and they can be relative. That means file A.dart can point to file B.dart via an absolute or relative path.
So, to answer you question, there is nothing special about a folder layout for Dart applications. The app will run as long as your Dart file can reference its dependencies via the same kind of linking rules that exist on the web (think <a href="" or <link src="").
However, pub (the Dart dependency manager) does make a few assumptions about package and application layout. If certain conventions are followed, pub can manage symlinks for you so that it's easier to reference 3rd party dependencies. Do you need to use pub? Nope, you can manually copy files around or manually manage symlinks. But pub certainly does make it easier to use packages, given the constraints of Dart's design (no load path, no classpath).

Resources