dsc / connect-compiler Goto Github PK
View Code? Open in Web Editor NEWDevelopment middleware to dynamically recompile derived files at serve-time.
Home Page: http://github.com/dsc/connect-compiler
License: MIT License
Development middleware to dynamically recompile derived files at serve-time.
Home Page: http://github.com/dsc/connect-compiler
License: MIT License
Since old compiled files are not deleted when recompiling the static middleware will serve the old file if compilation of the new file fails, which leads to confusion when developing while not paying close attention to the log.
One fix would be to delete the stale compiled file before trying to compile the new file.
the support for sass.js doesn't seem to work anymore:
with the following server.coffee
:
connect = require 'connect'
compiler = require 'connect-compiler'
# uncomment as required
# sass = require 'node-sass'
# sass = require 'sass.js'
server = connect.createServer(
connect.logger 'dev'
connect.favicon()
compiler
enabled: ['sass', 'coffee', 'jade']
src: 'src'
dest: 'tmp'
resolve_index: true
connect.static __dirname + '/src'
connect.static __dirname + '/tmp'
)
server.listen 8000
sass.js
installed:
sass not found
node-sass
installed:
sass not found
Please support Dust.js in connect-compiler.
I've added the compiler middleware to my Express app for development mode, with enabled = ['coffee']. However, the middleware crashes on every request, because when it tries to parse any request, it gets to a line that calls this.die() and fails because the "this" object doesn't have such method.
(The reason why it gets to this line isn't actually an error, it's trying to match a request that isn't even loading a static asset (it's handled by a controller action) and since the URL doesn't end with ".js", it gives up.)
Error message:
TypeError: Object # has no method 'die'
at Object. (.../node_modules/connect-compiler/compiler.js:487:12)
Hi!
For some unknown reason I cannot make the compiler work when the dest folder is a subfolder of my static folder.
app.use compiler
enabled: ['coffee']
src: "#{__dirname}/assets/coffee"
dest: "#{__dirname}/public/js"
app.use express.static "#{root}/public"
Is it a bug or am I doing something wrong? Thanks for your help!
You'll have to excuse me if I mis understood how connect-compiler
should work, but perhaps an option should be made available that skips writing/serving anything from disk and instead streams it directly.
If we all understand that assets should be compiled, minified, hashed, gzipped and bamboozled in production, then I hope we can understand that streaming compiled assets directly during development would eliminate any problems of stale files.
It should display error information, when compile error, test in less if have syntax error.
v0.1.2
Latest version of express, latest version of connect-compiler, and this code:
var express = require('express');
var compiler = require('connect-compiler');
var app = express.createServer();
pub = __dirname + '/public';
app.use (express.static (pub));
app.use (compiler ({src: pub, enabled: ['less']}));
app.listen(4100);
Write something in public/style.less, GET it, and then change it a few times: it doesn't update.
Any ideas?
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.