Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
gracie
Advanced tools
Readme
#Gracie
This is a web-service which will serve your JS files for you. It does a few spiffy things:
This allows you to accomplish the following objectives:
This app is written in node.js, but is really not for node.js. You can use it for any web project. It is for clinet-side javascript, not server-side.
#Installation
npm install gracie
#Synopsis
##Using as a standalone server
Run the server
gracie /path/to/js
Request your files
<script type="text/javascript" src="http://js.mysite.com/gracie?sources=a.js,b.js,c.js"></script>
And if the first line of c.js looks like this:
//require d.js
Then d.js will be included in the output.
You can also request minfied output
<script type="text/javascript" src="http://js.mysite.com/gracie?sources=a.js,b.js,c.js&minify=1"></script>
And you can have multiple source directories
gracie /path/to/js1 /path/to/js2
##Advanced integration with Node.js projects
If your project is written in Node.js and you are using connect, then you have two more options. First, set up the connect middleware.
app.configure(function() {
...
require('gracie').connect('/js', ['/path/to/js'])
...
});
The first parameter is the pathname that Gracie should handle. The second is an array of javascript source directories. With this in place, you can use your existing connect server to serve your js.
<script type="text/javascript" src="http://www.mysite.com/js?sources=a.js,b.js,c.js"></script>
The connect middleware will also make the Gracie Server instance available on all requests so you can request JavaScript content on-the-fly and embed it directly in the page. To do this, you'll want to generate the JavaScript in your controller and pass it to your view.
var minify = true;
req.gracieServer.getContent(['cool.js'], function(err, gracieResponse) {
res.render('myview.ejs', {
locals: { jsCode: gracieResponse.content }
});
}, minify);
Then, in your view, display the content. Be sure not to escape it.
<script type="text/javascript"><%- jsCode %></script>
#Tech Details about the bundled server
#License
(The MIT License)
Copyright (c) 2011 Dustin McQuay, Synchros Interactive
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
On-the-fly javascript contacatenator, minifier and dependency resolver for client-side JS
The npm package gracie receives a total of 1 weekly downloads. As such, gracie popularity was classified as not popular.
We found that gracie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.