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

grunt-tfc-datauri

v0.1.0

Published

The images path indicated to the 'manifest' variable of the file publish(ed) from 'Toolkit for CreateJS' is changeable to 'base64'.

Downloads

5

Readme

grunt-tfc-datauri

Getting Started

This plugin requires Grunt ~0.4.0

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-tfc-datauri

Then add this line to your project's gruntfile.js gruntfile:

grunt.loadNpmTasks('grunt-tfc-datauri');

Documentation

Flashのextensionである、「Toolkit for CreateJS」(※以降 TFC )を使用したプロジェクトで、 image画像を大量に使用している場合、スマートフォンでは画像のリクエストが増えてしまい、 3G回線端末などではロードに時間がかかってしまいます。

そこで画像データをdatauriで使用することによってリクエストを大幅に減らし、 ロード時間を短縮するテクニックがあります。

このpluginは、TFCでpublishされたhtml内のvar manifestjsonに記述されている画像パスに基づき、 画像をbase64化します。 そしてそのデータをhtmlに上書きします。 もしくは任意のファイルに出力します。

Example1

TFCによってpublishされたhtmlを上書きする場合

grunt.initConfig({

  tfcDatauri: {
    testfile:{
      file:'./test/tfc_publish_file.html'
    }
  }
});

html内のmanifest変数部分が、画像パスからdatauriに変わります。

Example2 (dest)

data uri化したデータを任意のファイルに出力します。

grunt.initConfig({

  tfcDatauri: {
    testfile:{
      file:'./test/tfc_publish_file.html',
      dest:'./test/manifest.js'
    }
  }
});

./test/manifest.jsが出力され、ここにdata uri化したデータが記述されます。

Example3(options)

optionsの指定で、manifestという変数名を変更できます。

grunt.initConfig({

  tfcDatauri: {
    testfile:{
      file:'./test/tfc_publish_file.html',
      dest:'./test/manifest.js',
      options:{
        log:true,
        //処理中のlogをconsoleに表示します
        varName:'foo' // var foo =[ ~
        //変数名が'manifest'以外の場合はvarNameで指定します。
      }
    }
  }
});

License

Copyright (c) 2013 Yota Kanke Licensed under the MIT license.

blog

  • blog http://kf-plvs-vltra.com/blog/