npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

super-bundle

v1.0.7

Published

bundle everything into HTML

Downloads

1

Readme

#super bundler

super-bundler 可以将多个文件,如 css, js, template 打包入 HTML 中。 相比其它前端模块化工具,它配置更加简单,且有很强的扩展性,尤其适合 SPA 这类不需要动态渲染 HTML 的 web 应用。

##Example

index.js

var logger = require('./logger');
logger.log();

logger.js

module.exports = {
    log: function(){
        console.log('hello world');
    }
};

index.less

@blue: #246AFF;
h1{
    color: @blue;
}

index.html

<!doctype html>
<html>
    <head>
    <bundle src="index.less" type="less"/>
    <bundle src="index.js" type="js"/>
    </head>
    <body>
        <h1>Super Pack</h1> 
    </body>
</html>

example.js

var Bundle = require('super-bundle'),
    fs = require('fs');

var options = {};

var bundle = new Bundle(options);

fs.readFile('./index.html', function(err,content){
    if(err) return console.error(err);
    
    bundle.exec('./index.html', content.toString(), function(err, content){
    
    if(err)return console.error(err);
    console.log(content);
         
    })
})
$ node example.js

output

<!doctype html>
<html>
    <head>
    <style type="text/css">h1 {
  color: #246AFF;
}
</style>
    <script type="text/javascript" id="$$$require">
;(function(global){var ms=[];function r(i){return ms[i]};r.ms=ms;global.$$$require=r;})("undefined"==typeof module?window:global);
</script><script type="text/javascript" id="./logger">
;(function(){var m={exports: {}};(function(require, module, exports){
module.exports = {
    log:function(){
        console.log('hello world');
    }
}


})($$$require,m,m.exports);$$$require.ms.push(m.exports||{});})();
</script><script type="text/javascript" id="index.js">
;(function(){var m={exports: {}};(function(require, module, exports){
var logger = require(0);
logger.log();


})($$$require,m,m.exports);$$$require.ms.push(m.exports||{});})();
</script>
    </head>
    <body>
        <h1>Super Pack</h1> 
    </body>
</html>

如果你设置了options.uglify = true,那么输出的结果将会全部被 uglify

<!doctype html><html><head><style type="text/css">h1 {color: #246AFF;}</style>style><script type="text/javascript" id="$$$require">
!function(n){function e(n){return o[n]}var o=[];e.ms=o,n.$$$require=e}("undefined"==typeof module?window:global);
</script>script><script type="text/javascript" id="./logger">
!function(){var o={exports:{}};!function(o,e,r){e.exports={log:function(){console.log("hello world")}}}($$$require,o,o.exports),$$$require.ms.push(o.exports||{})}();
</script>script><script type="text/javascript" id="index.js">
!function(){var r={exports:{}};!function(r,e,o){var $=r(0);$.log()}($$$require,r,r.exports),$$$require.ms.push(r.exports||{})}();
</script>script></head>head><body><h1>Super Pack</h1>h1> </body>body></html>html>

##options

  • uglify 是否 uglify
  • expandAll 展开所有的 bundle, (link="true" 的标签默认不会被展开)
  • paths 寻找文件的路径