ajorkowski / nodeassets Goto Github PK
View Code? Open in Web Editor NEWAsset Manager for .net that has live css updates using SignalR and can optionally leverage NodeJS compilers
Home Page: http://ajorkowski.github.com/NodeAssets
Asset Manager for .net that has live css updates using SignalR and can optionally leverage NodeJS compilers
Home Page: http://ajorkowski.github.com/NodeAssets
Rather than using CoffeeScript, would prefer it uses TypeScript.
Want to somehow integrate with the requirejs optimiser. I find with new projects that I am leaving out node assets (and all its benefits of runtime updates) so that I can use requirejs properly.
Right now I have a whole bunch of packages associated to the core node assets project due to compiler dependencies. I think the best idea is to move them out and people can add them as needed.
It would be neater and more convenient if CompilerFor took a file suffix enum, so rather than specifying ".js", etc. we can simply pick from list of predefined standard suffixes.
It should be possible to set a bool on the NodeAssets config which has it spit out source map files which are accessible to the browser.
I just implemented a really simple Hub to do live reloading of css, I think I had the same issue as you with the file changed event being fired more than once! You could probably simplify your code and get rid of the hashing code which will speed it up too :)
[HubName("cssWatcher")]
public class CssWatcher : Hub
{
public static void Init()
{
var cssPath = Path.Combine(HttpRuntime.AppDomainAppPath, "stylesheets");
var fsw = new FileSystemWatcher(cssPath)
{
Filter = "*.css",
IncludeSubdirectories = false
};
fsw.Changed += (sender, args) => OnCssFileChanged(args.FullPath);
fsw.EnableRaisingEvents = true;
}
public string Ping()
{
return "Pong";
}
private static Hashtable fileWriteTime = new Hashtable();
private static void OnCssFileChanged(string fullPath)
{
try
{
var currentLastWriteTime = File.GetLastWriteTime(fullPath).ToString();
if (fileWriteTime.ContainsKey(fullPath) && fileWriteTime[fullPath].ToString() == currentLastWriteTime)
return;
var instance = GlobalHost.ConnectionManager.GetHubContext<CssWatcher>();
instance.Clients.reload();
fileWriteTime[fullPath] = currentLastWriteTime;
}
catch
{
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.