jedfoster / SassMeister

The Sass playground
http://sassmeister.com
198 stars 25 forks source link

Is it possible to use your api? #56

Closed askucher closed 11 years ago

askucher commented 11 years ago

http://sassmeister.com/compile

jedfoster commented 11 years ago

Short answer: no.

I've thought about publishing the API, but I'm not clear on what the use case would be. Then there's the larger issue of limited resources; the app is currently operating on an extremely limited budget, and every API request means one less request for the app itself.

That said, I'm open to suggestions and am very interested in how you would use a public API.

askucher commented 11 years ago

The short proposition I can donate 10 $.

But question is that you need to find 1 000 000 people like me to satisfy your budget problem completely :)

On Thu, Oct 31, 2013 at 4:29 PM, Jed Foster notifications@github.comwrote:

Short answer: no.

I've thought about publishing the API, but I'm not clear on what the use case would be. Then there's the larger issue of limited resources; the app is currently operating on an extremely limited budget, and every API request means one less request for the app itself.

That said, I'm open to suggestions and am very interested in how you would use a public API.

— Reply to this email directly or view it on GitHubhttps://github.com/jedfoster/SassMeister/issues/56#issuecomment-27490083 .

jedfoster commented 11 years ago

Donations are always welcome! And yes, I need to find a few more people like you :-)

How you would use an API?

askucher commented 11 years ago

Just 2 persons. We will convert sass to css in our cms.

How can I pay?

When can I start use it?

On Thu, Oct 31, 2013 at 4:54 PM, Jed Foster notifications@github.comwrote:

Donations are always welcome! And yes, I need to find a few more people like you :-)

How you would use an API?

— Reply to this email directly or view it on GitHubhttps://github.com/jedfoster/SassMeister/issues/56#issuecomment-27492413 .

crockett95 commented 9 years ago

I would be interested this as well. Similar use case: compiling Sass in a CMS application. Would be interested in a subscription model if you're trying to finance more resources for such use.

jedfoster commented 9 years ago

@crockett95 Stay tuned. :-)

dwjohnston commented 3 years ago

Just for FWIW - I'm currently looking for a solution to dynamically compile sass in a browser, which is how I came accross this.

Been looking at sass.js but due to an issue with that, I'm looking at creating a 'compile the sass' API endpoint as a workaround.

I'd be happy to drop a donation/subscription if it saves me a day's work.

jedfoster commented 3 years ago

The compiler service itself could be as simple as this:

var compile = function(req, res) {
  var stats = {};
  var css = nodeSass.render({
    data: req.body.compiler.sass + ' ',
    outputStyle: req.body.compiler.outputStyle,
    stats: stats,
    success: function(css) {
      res.json({
        compiler: {
          css: css,
          stats: stats
        }
      });
    },
    error: function(error) {
      res.status(500).send(error);
    }
  });
};
app.post('/compile', compile);

See https://gitlab.com/jedfoster/bad-grizzly/-/blob/master/app/index.js.

That's old code and the current SassMeister API's compiler service is a bit more complex, but mostly because of the extensions that SassMeister provides. Parsing/embedding dependency frontmatter is the bulk of the service's code.

dwjohnston commented 3 years ago

^Alright cool thanks.

I've created a working minimal API here:

https://github.com/dwjohnston/sass-compiler-api