Packing together javascript files a .NET Web Application - javascript

I am writing a simple web app using NancyFX and the Razor view engine. I have little components in my web app that are having css, html and JavaScript. Each small component has its own folder in my Visual Studio solution.
When compiling I would like to pack together all the JavaScript code into one large file and include only that in my master-page. Something similar to ruby's sprocket gen would be the best.
Is there any solution for this problem?

Related

Make a javascript 'code snippet' app an installable windows .exe using VS CODE?

Ive been learning html, css, js, php, mysql, (touched on node js but ran away from it - too much too soon) for a few months now and would like to make a simple categorized code snippet app as a learning project and to aid my crap memory!
I couldnt find a relevant answer so, hopefully its not a dumb question:
I want to primarily stick with js to get a good coding knowledge base so will make the snippet app using js, and .txt files as the storage. Using VS Code, what would be the best practice/method?
I know I could just make it browser based, but would rather have a little app I can pin to the taskbar, as im coding/self teaching full time atm.
The HTML, CSS and Javascript natively supported by browsers to develop Web Apps (You cannot run as a native app). The .EXE files are executable binary files of Windows. If you want to build Native Apps using HTML, CSS & JS, You have couple of options.
Electron JS
Electron JS is a amazing tool, To build cross-platform apps. You can develop your apps using HTML, CSS and JS and build it to any major platforms.
VS Code, Invision, MS Teams are built on electron Js
https://www.electronjs.org/
Use WebView on Native App
If you don't need to access any native function of the system, Then you can go with WebView. The web view is a feature to embed a website inside a native app. Most of the languages/frameworks have web-view support (Eg:- .Net).
If you are focusing on windows, Try .NET Web View

Should we integrate SpringMVC(Thymeleaf, Jsp) with Js frameworks (Reactjs, AngularJs,..)

I'm new to Js frameworks like Reactjs, AngularJs.
And I'm tasked by my customers with the responsibility of researching to integrate Thymeleaf with one of javascript framework to handle common components (commonality and componentization task) in my project.
But i'm wondering whether it's necessary to use a js framework along with SpringMVC and should we combine these technologies in java web application?
Thanks alot. I have searched for result for hours but no appropriate one found!
please refer blow 2 link,
https://github.com/noveogroup-amorgunov/spring-mvc-react
https://medium.com/#pietroghezzi/spring-and-react-js-the-easy-way-5abe8a529058
I develop differently these examples, first I develop frontend project and build. after creating an MVC project and moved my static build into the static folder. then build java project got a working project.

Visual Studio Designer for Javascript App

I'm writing an application and after some Proof-of-concept work I'm starting to design the app in UML. It will be an HTML5/Javascript app with a simple ASP.NET backend serving data over SignalR and AJAX to the front.
I want to design the C# classes and the JS "classes" in UML and I'm testing out the Visual Studio designer (2013) to see if it'll work. My problem is that the designer always create C# classes for every UML class, but some of these will be JS classes. Is there any way to turn off the code generation?
Comments on other/better tools are welcome.

Build-time assembly of HTML and JS fragments for Single-page applications

I'm preparing to write a large single-page app but I'm looking for a better way to develop it than writing the whole thing as a single file. I'm concerned about maintainability and testibility so I'd prefer to split it up into modules or fragments which can be developed and tested separately, then assembled into a single file at build-time. I don't believe I'll need to do any server-side templating so the final file delivered to the browser will be static and any customization done via JavaScript in the browser.
What I think I'd also like (but perhaps tools with better methods exist but I just haven't found them yet) is to develop the HTML fragments within full, self-contained HTML files so that they can be tested as standalone pages without having to assemble the entire app. This means there would need to be a way to tell the assembly tool which part of a fragment file is the actual fragment so that it should discard the HTML sandbox surrounding it.
Are there any development tools which would enable me to do this?
You are planning to build a modular application am i right? then take a look at these resources:
Nicholas Zakas' scalable, modular JavaScript - this one discusses the "take apart and individually testable" part you are looking for
RequireJS for inter-JS dependency handling - for JS files that need other JS files to work
BackboneJS - for structuring your application
Mustache template builder - to avoid writing your HTML in JS files
an multi-purpose toolkit like jQuery

Assets packaging tool like jammit for JSP, Java EE projects?

We've got a lot of javascript and CSS files in our Java EE project. We're wondering if there's a tool to help you package(minification) these files, like the jammit tool in Rails?
For instance, in a JSP page, i want to do something like this:
<tag:include_stylesheets :common, :workspace, :media => 'all' />
<tag:include_javascripts :workspace />
In development, no packaging is performed, so you'll see a list of individual references to all of the JavaScript and CSS files. When we package a war file, it compiles javascript into a single file(or a few files and only include the one that's used)
Is there any tool like that for JSP?
Yes - Jawr - "Bundling and compression for javascript and css"
(Actually, building your own is rather simple, but it's better to reuse the library)
There are several more options:
pack:tag - Comprehensive JavaScript and CSS packaging solution
jso - JavaScript Optimizer
wro4j - Web Resource Optimizer for Java
Disclaimer: Though I'm working on one of these, the answer is unbiased.

Categories