Coder Social home page Coder Social logo

sinatra-backbone's Introduction

๐ŸŽ‰

Hello! I'm Rico. You can find me in Mastodon or Twitter. You might know me from a few open source projects that are now maintained by the community:

pnpm (pnpm/pnpm) is a npm management tool. Original author. GitHub badge
Mina (mina-deploy/mina) is a fast web app deployment tool. Original co-author. GitHub badge
js2coffee (js2coffee/js2coffee) compiles JavaScript into CoffeeScript. Original author. GitHub badge

I manage a humble website with cheatsheets for web developers:

Devhints (https://devhints.io/) is a website of cheatsheets by developers for developers. GitHub badge

Some of my projects:

nprogress is a light-weight progress bar. GitHub badge
rscss is a unique CSS methodology. GitHub badge
remount allows creating web components from React components. GitHub badge
expug is a Pug template compiler for Phoenix and Elixir. GitHub badge

I'm proud of a few of my Vim plugins:

vim-closer closes braces automatically and unobtrusively. GitHub badge
vim-hyperstyle lets you type CSS faster. GitHub badge
vim-opinion is a set of opinioned defaults for Vim. GitHub badge

I also wrote a few Ruby and JavaScript things here and there :)

sinatra-backbone's People

Contributors

charlieschwabacher avatar drewda avatar dunedain289 avatar leoc avatar rstacruz 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sinatra-backbone's Issues

Newlines escaped by inspect causing problems interpreting javascript

We're having some issues where the javascript template generated escapes newlines that break the javascript interpretation.

The root of the problem is here: https://github.com/rstacruz/sinatra-backbone/blob/master/lib/sinatra/jstpages.rb#L200

Since you're writing the content inspected instead of just the straight content, newlines are escaped and written as \n. This breaks some of the javascript in those templates.

What is the reason why you chose to print the content inspected instead of just the straight content? Could we remove the inspect without issue?

rest_params & firefox

firefox puts charset in content_type, rest_params helper method expects content type being just mime

It doesn't work with ECO - TypeError: Object #<Object> has no method 'slice'

I can't get this gem to render ECO templates: when I try, I get the Javascript error TypeError: Object #<Object> has no method 'slice'.

Here's a minimal app that produces the error:

- views/
  - eco_example.jst.eco
  - home.erb
  - tpl_example.jst.tpl
- app.rb
- config.ru
- Gemfile
- Gemfile.lock

Gemfile
-------

source "http://rubygems.org"
ruby "2.1.0"
gem "sinatra"
gem "sinatra-backbone"


config.ru
---------

ENV["RACK_ENV"] ||= "development"

require "bundler"
Bundler.require
$LOAD_PATH << "."
require "app"
run Example


views/home.erb
--------------

<!doctype html>
<html>
<head>
  <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
  <script src="/jst.js"></script>
</head>
<body>
Hello, world!
</body>
</html>


app.rb
------

class Example < Sinatra::Base
  register Sinatra::JstPages
  serve_jst "/jst.js"

  get "/" do
    erb :home
  end

end

views/eco_example.jst.eco and views/tpl_example.jst.tpl both just contain the HTML string <div></div>.

If I start the server with rackup and type JST["tpl_example"](), it returns <div></div> as expected. But JST["eco_example"]() throws the error TypeError: Object #<Object> has no method 'slice'.

Am I missing something, or is this a fault with the gem? I had to include Underscore to get tpl_example to work - is there something similar I need to include for eco to work? Adding the eco gem didn't help.

Example using assetpack

Would it possible to get a simple example using assetpack to package .jst files? Thanks for all the awesome work you've done!

JST pages appear to be generated on every request

Hi,

I'm trying to speed up my application and am using this Gem. In my configure block I run:

configure do

  require 'sinatra/jstpages'      
  register ::Sinatra::JstPages  
  serve_jst '/jst.js'      

end

And I was wondering if you knew of a way to keep these pages from being re-generated on every request as I think it would be faster if they were only loaded when starting the server.

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.