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

gulp-requirejs-optimizer

v0.9.8

Published

personal achieve project for requirejs optimize --- gulp-requirejs

Downloads

35

Readme

gulp-requirejs

Build Status Coverage Report Package Dependency Package DevDependency

Custom migration to gulp-requirejs, inspired by grunt-contrib-requirejs.

Instruction

  • The project still in state of development, maybe not ready for production environment.
  • All defined modules should in one particular directory like ./modules (plugins or any other requirejs specific modules included), any other libs with global variable outside the directory just import their contents, without any processing.
  • When opts.path undeclared, all module name(auto added) and module dependent name should be relative path without dot, oblique at the beginning or extname at the end.
  • When opts.path declared, module name would be path config value, not original relative path.
  • Only optimize define module, non-support with require, which means error throw.

Feature

  • Support single requirejs file optimize.
  • Support multi requirejs file optimize.
  • Support specific config options path.(the path maps modules in the specific directory and libs outside the specific directory).
  • Files outside the directory would import into the final optimized file without processing.
  • Partial plugin support. Dependency like define['html!template/main'],function(template){}) doesn't emit error event anymore since v0.8.5, and optional import the plugin contents by opts.plugin.
  • Support recursive moduleDependency optimize, but the depth limited to 2. The dependencies of direct dependencies will import.

options

Config options below provided now.

{
    // the baseUrl to search modules, relative to `gulpfile.js`
    baseUrl: './test/fixtures',
    // the mapping about specific module, dependent on `html` means 
    // `subFixtures/html.js` file will be imported.
    path: {
       'html': 'subFixtures/html',
       'jquery': '../mockLibs/jquery',
       'client': '../mockLibs/client'
    },
    // the module name you want to optimize, string or array
    module: 'optimize-info',
    // whether import plugin contents or not
    plugin: false, 
    // whether import contents recursively
    recursive: false
}

Progress

  • Support single file optimize with define style, just execute gulp example-basic or gulp example-sub to see the effect. javascript files in sub-directory of baseUrl accepted.

  • Support multiple file optimize with define style, just execute gulp example-multi to see the effect. You will get dist/optimize-info.js, dist/optimize-sub.js.

  • Support path config file optimize in the specific directory with define style, just execute gulp example-path to see the effect. You will get dist/optimize-path.js.

  • Support path config file optimize outside the specific directory, just execute gulp example-path to see the effect. You will get dist/optimize-outside.js.

  • Support file optimize with dependency on plugins, just execute gulp example-plugin to see the effect. You will get dist/optimize-plugin.js.

  • Support file optimize recursively, just execute gulp example-recursive to see the effect. You will get dist/optimize-recursive.js.

Annotation

example-basic, you have modules in the baseUrl directory as below:

lang.js

define([],function(){});

logger.js

define([],function(){});

optimize-info.js

define(['lang','logger'],function(lang,logger){});

after gulp example-basic, you will get dist/optimize-info.js, whose contents as below:

define('lang',[],function (){});
define('logger',[],function (){});
define('optimize-info',['lang','logger'],function (lang,logger){});

example-recursive, you have modules in the baseUrl directory as below:

lang.js

define([],function(){});

logger.js

define(['lang'],function(){});

optimize-info.js

define(['logger'],function(logger){});

structure will get contents below after optimize

define('lang',[],function (){});
define('logger',['lang'],function (){});
define('optimize-info',['logger'],function (logger){});