Giter VIP home page Giter VIP logo

connect-assets-jsprimer's Introduction

connect-assets-jsprimer Build Status

An NPM module that forces compilation of your javascript connect-assets without referencing them in a view.

Problems This Helps With

  • You are using requireJS and don't want to reference all your javascript files in the view.
  • You have a javascript file that is dynamically loaded on your page but not in the view.

Installation

npm install connect-assets-jsprimer

  • There is a dependency on CoffeeScript. If you want a straight javascript version, you can compile it easily yourself.

Usage

assets = require 'connect-assets'
jsPrimer = require 'connect-assets-jsprimer'

# Snip ...

app.use assets()
jsPrimer.loadFiles assets

# Optionally, you can pass in a log function to see progress
# jsPrimer.loadFiles assets, console.log

Contributors

Jacob Gable

Adrien Antoine

Jonathan Chapman

Copyright

Created by Jacob Gable. MIT License; no attribution required.

connect-assets-jsprimer's People

Contributors

acruikshank avatar adriantoine avatar chafnan avatar jgable avatar jwmerrill avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

connect-assets-jsprimer's Issues

Ignoring .swp.js files

Hey,

I like this package quite a bit but I am running into a problems while developing with it.

I use vim to develop and vim creates .swp.js files. They are hidden by default (prefix with .) but your primer tries to server them. Is there a simple work around for this?

Best,
Jeremy

Example usage doesn't work

jsPrimer exports an object, not a function, so you can't run

jsPrimer assets

I think the example usage should read

jsPrimer.loadFiles assets

Watched files in windows environment getting 'No file found for route'

Watched files are throwing an error in a windows environment. The cause is the slash '' that windows use is not correctly dealt with in the FileLoader.

Getting the following error back:

Error: No file found for route js/ssets\js\main.js
  at ConnectAssets.compileJS (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets\lib\assets.js:453:13)
  at ConnectAssets.<anonymous> (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets\lib\assets.js:163:25)
  at FileLoader.context.js [as assetJS] (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets\lib\assets.js:170:14)
  at FileLoader._loadJSFileOrDirectory (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\lib\FileLoader.coffee:50:21)
  at _Class.watchOptions.listener (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\lib\FileLoader.coffee:60:17)
  at _Class.EventEmitter.emit (events.js:106:17)
  at _Class.bubble (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\node_modules\watchr\out\lib\watchr.js:117:10)
  at _Class.watch.listener (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\node_modules\watchr\out\lib\watchr.js:272:26)
  at _Class.EventEmitter.emit (events.js:106:17)
  at determineTheChange (c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\node_modules\watchr\out\lib\watchr.js:195:26)
  at c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\node_modules\watchr\out\lib\watchr.js:209:18
  at c:\Users\jon\source\web-infrastructure-provider-console\node_modules\connect-assets-jspaths\node_modules\connect-assets-jsprimer\node_modules\watchr\node_modules\bal-util\out\lib\paths.js:98:18
  at Object.oncomplete (fs.js:107:15)

I have debugged the error back to the FileLoader. The correct path is assets\js\{filename}

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.