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-inline-assets

v0.1.5

Published

grunt-inline-assets

Downloads

2

Readme

grunt-inline-assets

将HTML代码中引用的js和css文件读取为内联,外部文件可以是本地也可以来自网络

Getting Started

依赖 Grunt 版本~0.4.1

安装

npm install grunt-inline-assets --save-dev

安装后,在 Gruntfile.js 中载入任务

grunt.loadNpmTasks('grunt-inline-assets');

任务配置

步骤

grunt.initConfig() 中添加的配置:

'inline-assets':{
	options:{
		encoding:'utf8',
		// KISSY Modules Maps File 地址,会新增到KISSY MINI种子文件的后面
		// 如果没有引用KISSY,将不会新增
		comboMapFile:'../../map.js',
		onlineFileSSIOnly: true, // 只合并线上文件,本地文件不合并,默认为false
		jsmin: true, //内置js文件时是否进行jsmin,默认为false
		cssmin: true //内置css文件是否进行cssmin,默认false
	},
	main:{
		files: [
			{
				expand: true,
				cwd:'build',
				src: ['pages/**/*.html'],
				dest: 'build/'
			}
		]
	}
}

比如源文件:

<!DOCTYPE HTML>
<html>
<head>
	<link rel="stylesheet" href="./index.less.css"/>
	<link rel="stylesheet" type="text/css" href="http://g.tbcdn.cn/??tpi/pi/1.1.0/base/index-min.css" />
	<script src="http://g.tbcdn.cn/kissy/m/0.2.1/mini-full-min.js"></script>
	<script src="../../config.js"></script>
</head>
<body>...</body>
</html>

构建后的文件

<!DOCTYPE HTML>
<html>
<head>
	<style>CSS文件内容</style>
	<style>CSS文件内容</style>
	<script>KISSY MINI 种子文件内容</script>
	<script>map.js内容</script>
	<script>config.js内容</script>
</head>
<body>...</body>
</html>