Giter Site home page Giter Site logo

ajorkowski / nodeassets Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 1.0 11.61 MB

Asset Manager for .net that has live css updates using SignalR and can optionally leverage NodeJS compilers

Home Page: http://ajorkowski.github.com/NodeAssets

C# 53.62% JavaScript 43.82% CSS 2.25% ASP 0.04% CoffeeScript 0.09% TypeScript 0.17%

nodeassets's People

Contributors

ajorkowski avatar santas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

santas

nodeassets's Issues

Requirejs support

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.

Compilers add too many junk packages

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.

Add file suffixes enum

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.

Option to generate source map

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.

Easy way to detect file change, and not have the event fire more than once.

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
    {
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.