Git Product home page Git Product logo

harp's People

Contributors

alexgleason avatar bluet avatar bmann avatar ccprog avatar chkal avatar devgeeks avatar dpogue avatar dscape avatar edrex avatar filipesilva avatar georgzoeller avatar jamieslome avatar jorgepedret avatar jvandemo avatar kebot avatar kennethormandy avatar mannyluvstacos avatar marcoslopezc avatar maxkoloskov avatar mufeedvh avatar mwbrooks avatar patatero avatar printercu avatar prinzhorn avatar remy avatar shovon avatar silentrob avatar sintaxi avatar yajo avatar zeke 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

harp's Issues

harp compile creates absolute path for css file

How to reproduce:

% harp init myharpproject
% cd myharpproject
% harp compile
% cat www/index.html
  <!DOCTYPE html>
  <html>
    <head>
      <link rel="stylesheet" href="/css/main.css">
    </head>
    <body>
      <h1>Welcome to Harp</h1>
      <h3>This is yours to own. Enjoy.</h3>
    </body>
  </html>
% _

(Line breaks added by me)

Open www/index.html in the browser -> the stylesheet cannot be found.

The URL of the stylesheet is absolute to the "document root" which is not necessarily the case and depends on where you deploy the app to.

Suggestion: replace the absolute URL with URL relative to index.html.

Best regards
Christian

Can’t visit IP while using multihost

If I visit the local IP and port on my computer or another device while using multihost, I get

Local server does not support history. Perhaps you are looking for <href='http://192.168.1.io:9966'>http://192.168.1.io:9966</a>.

instead of my app. It works as expected while using server.

Server crashing when url doesn't contain slash at the end for directories

Directory structure:

/public
  /index.jade
  /getting-started
    /index.jade
    /page2.jade

When I go to http://localhost:8001/getting-started the server crashes with this error:

/usr/local/lib/node_modules/harp/lib/middleware.js:44
    if (!redirect) return resume();
         ^
ReferenceError: redirect is not defined
    at SendStream.directory (/usr/local/lib/node_modules/harp/lib/middleware.js:44:10)
    at SendStream.EventEmitter.emit (events.js:115:20)
    at SendStream.redirect (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:271:55)
    at SendStream.pipe (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:321:41)
    at Object.oncomplete (fs.js:297:15)

It works fine if you go to http://localhost:8001/getting-started/ (with the slash at the end).

Using [email protected]

Nicer CSS error messages

When there's something broken in my LESS file, it'd be nice if instead of giving me back an html/text response, I get back the error injected in CSS like this:

body:before {
  display: block;
  content: "There was an error in your CSS, fix it!";
  border: #EED3D7 solid 1px;
  border-radius: 5px;
  color: #B94A48;
  background-color: #F2DEDE;
  padding: 10px;
  margin: 20px;
  font-family: monospace;
  font-size: 14px;
}

layout: true looks for true.jade instead of _layout.jade

In a data.json file, you might switch a layout from false to true instead of deleting the entire entry:

{
  "index": {
    "layout": true
  }
}

Expected Behaviour
This uses _layout.jade as a layout it it’s present. (Basically, it’s an explicit way to perform the default behaviour.)

Actual Behaviour
The layout true.jade is used if it’s present.

Cannot set property 'environment' of undefined

My harp.json file only has this:

{}

Using 0.7.0
This is the error I'm getting:

TypeError: Cannot set property 'environment' of undefined
    at Object.exports.parseHarpConfig [as handle] (/usr/local/lib/node_modules/harp/lib/middleware.js:112:34)
    at next (/usr/local/lib/node_modules/harp/node_modules/connect/lib/proto.js:190:15)
    at resume (/usr/local/lib/node_modules/harp/lib/middleware.js:54:5)
    at SendStream.error (/usr/local/lib/node_modules/harp/lib/middleware.js:67:35)
    at SendStream.EventEmitter.emit (events.js:95:17)
    at SendStream.error (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:147:51)
    at SendStream.onStatError (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:248:48)
    at /usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:320:26
    at Object.oncomplete (fs.js:93:15)

Unable to minify CSS when working with LESS

Because the actual CSS file is never written to disk when working with LESS, there's no way for me to minify the resulting CSS.

A possible solution would be to specify the output I want in the harp.json file, but that could be a slippery slope.

// harp.json
{
  "config": {
    "compress-css": true,
    "compress-js": true,
    "compress-html": true
  }
}

Compile clobbers existing directories

Compile clobbers existing directories

Steps to reproduce

  1. Create a directory ( let's call it blog ) and put some content in it... say a .git folder, .gitignore
  2. Run harp init in this folder ( possibly in a src directory )
  3. Run harp compile --output /path/to/blog

Expected results

Static files generated into the blog directory ( root of project )

Actual results

Directory is clobbered instead of added to losing any content you had in it

`pkg` variables only passed to multihost template

Using pkg.name or pkg.version outside of index.jade prevents the template from rendering.

The expected behaviour would be that they’re available in any file inside the templates directory. If this is difficult or inefficient, having them available in a partial I can include everywhere would also work. Ideally, I’d like to be able to use pkg.name anywhere in the templates “Harp” might be hardcoded.

Special Characters interfere with HTML

Using special characters in Jade or Markdown causes the HTML file to end a few characters early. This can cause a loose </ to show up, rendered on the page, prevent tags from closing, etc.

This is possibly a duplicate of issue #40.

Input

!!!
html(lang="en")
    head
        meta(charset="utf-8")
        title= globals.title
    body
        h1 Should’t “Do This” & more…

Expected Output
(Line breaks are for readability, the HTML compression is working fine.)

<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"><title>Harp</title></head>
<body><h1>Should’t “Do This” & more…</h1>
</body>
</html>

Actual Output

<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"><title>Harp</title></head>
<body>
<h1>Should’t “Do This” & more…</h1>

If you don’t use the proper characters and reference the special characters instead, the output is as you’d expect:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"><title>Harp</title></head>
<body><h1>Should't "Do This" &amp; more&hellip;</h1>
</body>
</html>

“Cannot find project” improvment

If you visit a subdomain without an app while using multihost, you just get Cannot find project printed in the browser.

The expected behaviour would be that an error template is used to handle this. Basically, “There’s no app here, but here’s a list of the apps you are currently hosting.”

Error running default boilerplate app

I'm following the Get Started pages. When I start the server (default settings) I observe two errors. (Previous steps did not display any errors)

  1. Visiting http://localhost:9966 results in a 404 error. Adding /index.html works. The index.jade file is served.
  2. Request for the stylesheet /css/main.css results in a 404 error. The less file is not compiled.

I'm on Windows 7. Harp version 0.8.13.

Vague error message when port is in use

.#===========================================================
.# Harp
.#===========================================================
.# It appears you already have a server
.# listening on this port. You will first
.# have to stop that server to get Harp
.# to listen on this port.
.#===========================================================

What port am I conflicting with? - This is in pipeline mode.

Add url where harp is running after executing multihost or server

Show me the url where my server is running at when I start it:

$ sudo harp multihost -p 80
Hosting multiple projects at http://harp.nu

Available projects:
- http://docs.harp.nu
- http://hello.harp.nu
$ sudo harp multihost -p 8080
Hosting multiple projects at http://harp.nu:8080
...
$ sudo harp server -p 80
Hosting project at http://harp.nu

Show better error for port in use

$ sudo harp multihost -p 80

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:863:11)
    at Server._listen2 (net.js:1008:14)
    at listen (net.js:1030:10)
    at Server.listen (net.js:1096:5)
    at Function.app.listen (/usr/local/lib/node_modules/harp/node_modules/connect/lib/proto.js:229:24)
    at Object.exports.multihost (/usr/local/lib/node_modules/harp/lib/index.js:52:5)
    at Command.<anonymous> (/usr/local/lib/node_modules/harp/bin/harp:64:10)
    at Command.<anonymous> (/usr/local/lib/node_modules/harp/node_modules/commander/index.js:254:8)
    at Command.EventEmitter.emit (events.js:98:17)
    at Command.parseArgs (/usr/local/lib/node_modules/harp/node_modules/commander/index.js:471:12)

Error when harp.json file not present

I get this nasty looking error when harp.json file is not present. Can we make it say something nicer?

Error: ENOENT, no such file or directory '/Users/jorge/Projects/three/harp.json'
    at Object.fs.openSync (fs.js:338:18)
    at Object.fs.openSync (/usr/local/lib/node_modules/harp/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js:68:26)
    at Object.fs.readFileSync (fs.js:182:15)
    at module.exports (/usr/local/lib/node_modules/harp/lib/config.js:7:21)
    at Object.module.exports.config [as handle] (/usr/local/lib/node_modules/harp/lib/middleware.js:33:24)
    at next (/usr/local/lib/node_modules/harp/node_modules/connect/lib/proto.js:190:15)
    at resume (/usr/local/lib/node_modules/harp/node_modules/connect/lib/middleware/static.js:60:7)
    at SendStream.error (/usr/local/lib/node_modules/harp/node_modules/connect/lib/middleware/static.js:73:37)
    at SendStream.EventEmitter.emit (events.js:115:20)
    at SendStream.error (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:147:51)

Jade extends considered a syntax error?

Everything works fine, but when I use the extends command in Jade, it is considered a syntax error and won''t build

My code is

   1| extends _layout
   2| 
   3| block content
   4|  h1 Hello!

Jade Blows up on missing comma

undefined:44
buf.push(attrs({ terse: true, 'src':("master.css" type="text/stylesheet") }, {
^^^^
SyntaxError: Unexpected identifier
at Object.Function (unknown source)
at Object.exports.compile (/usr/local/lib/node_modules/harp/node_modules/jade/lib/jade.js:176:8)
at module.exports.jadeCompiler (/usr/local/lib/node_modules/harp/lib/parsers.js:22:27)
at fs.readFile (fs.js:176:14)
at fs.close (/usr/local/lib/node_modules/harp/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js:90:5)
at Object.oncomplete (fs.js:297:15)

Simple index.html throwing a missing 404.jade error

I'm just setting up a simple site with one index.html file, visited it from the browser and I get an error:

Error: ENOENT, no such file or directory '/Users/kalv/Development/sites/caliper-landing/public/404.jade'

This is probably due to the web browser looking for a favicon, couldn't confirm because I couldn't see an easy way to set debug mode or something on the CLI.

If it is the favicon, could a default 404 response code be sent back to better handle those that don't have a 404 jade template?

Add support for browserify

First off, I have to say this looks amazing! The only thing I think it's really lacking is client-side JavaScript compilation and minification. I think browserify would be a match made in heaven! Any chance that we might see support for browserify added? Thanks!

Compiling shows EISDIR error

When trying to compile docs project, it shows an EISDIR error in the terminal, but it doesn't seem to terminate the process or show any errors:

Screen Shot 2013-03-11 at 5 46 11 PM

'harp' command is not found

I've installed harp by using the command(s): 'npm install -g harp' and 'sudo npm install harp -g'. It looks like everything's installed within the npm.

But, whenever I enter 'harp', it says '-bash: harp: command not found'. Is it supposed to say that before making a project?

Stylus output is compressed differently

The following could be either Stylus or LESS:

body {

  background: #f0f;

}

div {

  background: #f00;

}

If it’s LESS, it will be compiled as:

body {background: #f0f;}
div {background: #f00;}

If it’s Stylus, it is compressed, but not quite as much:

body {
  background: #f0f;
}
div {
  background: #f00;
}

Unless this is something being specified by the preprocessor, I would have expected the compression to happen way for both.

Show error when bad data or harp json file

Show an error message, either in browser or in terminal, saying that there's a problem with my _data.json or _harp.json files.

It doesn't need to show the details of the error, just saying that there's something wrong with the files would be helpful enough (for now).

Multihost doesn’t show all apps

harp multihost only shows apps in folders with a “subdomain.” So, something.cssbrigade.com is valid, but cssbrigade.com isn’t. It has nothing to do with harp being in the name like I had initially said.

Harp init doesn’t work as of 0.8.0

As far as I can tell, harp init doesn’t do anything in 0.8.0 or 0.8.1. If you pass it a project to create, it also ignores that. It still says initialized project at even though nothing happened.

I tested it with fresh installs of 0.7.10, 0.8.0 and 0.8.1 and it only worked in 0.7.10.

CSS error messages can end early

The new style of CSS error messages is great! There’s just a small problem when the message has quotations, as it ends the pseudo element early. Escaping them as \" fixes it.

screen shot 2013-07-15 at 11 11 44 am
screen shot 2013-07-15 at 11 11 58 am

Specify responses encoding

Express defaults the charset as utf-8. That behaviour is being overwritten by Harp APF on these files:

https://github.com/sintaxi/harp/blob/master/lib/middleware.js#L231
https://github.com/sintaxi/harp/blob/master/lib/index.js#L111

Here's a quick test that shows the problem:

  1. Create /test/apps/basic/public/characters.jade
h1 ‘This page has weird characters’
p À, Á, Â, ¬, ¯, ±, é, É, å, ä, ö
  1. Add to /test/basic.js:
it("should have UTF-8 by default in content type header", function(done){
  var agent = superagent.agent()
  agent.get('http://localhost:8100/characters').end(function(err, rsp){
    rsp.should.have.status(200)
    rsp.headers['content-type'].should.include('UTF-8')
    rsp.text.should.include('À, Á, Â, ¬, ¯, ±, é, É, å, ä, ö')
    done()
  })
})

The second assertion passes, but when you look at it in the browser all the characters are messed up. Not sure how to assert for that from Mocha.

The problem seems to be that you're passing 'html' instead of 'text/html' to the charset lookup function. The charset works fine when you replace mime.charsets.lookup(outputType) with mime.charsets.lookup(mimeType) on the two files mentioned above.

You could also add mime.charsets.lookup(mimeType)||'utf-8' to make utf-8 the default, in case the charset lookup returns nothing.

Make harp.json file optional

This is the error I get if there's no harp.json file

Using 0.7.0

Error: ENOENT, no such file or directory '/Users/jorge/Dropbox/HarpPlatform/Apps/blog2.harp.io/harp.json'
    at Object.fs.openSync (fs.js:413:18)
    at Object.fs.openSync (/usr/local/lib/node_modules/harp/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js:68:26)
    at Object.fs.readFileSync (fs.js:270:15)
    at Object.exports.parseHarpConfig [as handle] (/usr/local/lib/node_modules/harp/lib/middleware.js:85:21)
    at next (/usr/local/lib/node_modules/harp/node_modules/connect/lib/proto.js:190:15)
    at resume (/usr/local/lib/node_modules/harp/lib/middleware.js:54:5)
    at SendStream.error (/usr/local/lib/node_modules/harp/lib/middleware.js:67:35)
    at SendStream.EventEmitter.emit (events.js:95:17)
    at SendStream.error (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:147:51)
    at SendStream.onStatError (/usr/local/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:248:48)

layout path should be relative to the template.

Specifying a layout in _data.json will be how to override the implicit layout behaviour and this file path should be relative to the template file. This makes sense because the _data.json file lives where the template file lives.

Add -validate option to CLI

The only way to validate that your template works in Harp Platform is to compile the template and see if it shows any errors.

It'd be better to have a validate option to take care of that for you.

$ harp -validate
OK
$ harp -validate
{
  "status": 400,
  "message": "Template Render Error",
  "dump": {
    "path": "/Users/jorge/Dropbox/harp.io/apps/jorge.harp.io/public/index.jade"
  }
}
$ harp
...
validate [path] checks if project compiles correctly
...

Special characters interfere with CSS

Using special characters in a LESS or Stylus file causes the end of the CSS file to get cut off a few characters early.

Input

q
    quotes: "" "" "" ""

body
    background: #FF00AA

Expected Output

q {
    quotes: "“" "”" "‘" "’";
}
body {
    background: #FF00AA;
}

Actual Output

q {
  quotes: "“" "”" "‘" "’";
}
body {
  background:

“Too Many Open Files” error

When I have too many files, I can’t compile them right now. It doesn’t seem to impact harp server, just harp compile. This is the error I got:

Error: EMFILE, too many open files
    at ncp.ncp (/usr/local/lib/node_modules/harp/node_modules/fs-extra/node_modules/ncp/lib/ncp.js:12:26)
    at Object.copy (/usr/local/lib/node_modules/harp/node_modules/fs-extra/lib/copy.js:34:7)
    at exports.compile.copyFile (/usr/local/lib/node_modules/harp/lib/index.js:191:13)
    at /usr/local/lib/node_modules/harp/node_modules/mkdirp/index.js:38:26
    at Object.oncomplete (fs.js:297:15)`

A possible solution

Stylus files aren’t imported on compile

When you compile your app, Harp creates every Stylus file as an individual CSS file in addition to importing them.
It doesn’t render the variables in these files, which is presumably related.

If I have main.styl and import something.styl, on compile I’ll end up with main.css and something.css (instead of just main.css). The main.css file will have everything, but if I used a variable from main.css in something.css, it will render as plain text instead of the value.

I tested this a bunch and can share my test app with you if you want.
When using the server, everything seems to be in order.

Error when Nesting less files

I have two files:
bar.less

body {
  background: #000;
}

foo.less

@import bar.less
body {
  border: red solid 10px;
}

Expected behaviour: The body will render a black background with a 10px red border

Current behaviour: The CLI breaks outputting the following error:

/usr/local/lib/node_modules/harp/node_modules/less/lib/less/parser.js:418
                        else                                  throw new(LessEr
                                                                    ^
[object Object]

Add support for YUICompressor

For example, if you point to a *-min.js or *.min.js and the is no matching file, then harp should use YUICompressor on the equivalent non-minified file. There should also be a command line option for disabling/enabling the compression feature for the harp compile command.

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.