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

html-css-scope-loader

v0.0.5

Published

html add css scope ( html template add css module)

Downloads

3

Readme

html-cssScope-loader

这是一个参考vue-loader,为了解决CSS作用域实现的一个loader,为解决template添加css作用域的loader方案,支持sass,less,css三种解析

参考vue-loader:data-v-xxxxx方案实现,而非css-loader的CSS module方案

目前使用在一些 AngularJS 1.xx 版本 和一些需要innerHTML等动态解析html生产DOM的项目中

采用vue-loader:data-v-xxxxx方案主要是为了解决ng-class等类似 动态渲染的class情况

注意 loader返回的html内容是string类型的html->template,并不是真实的dom元素

Installation

npm install html-css-scope-loader

Examples

Webpack ->rules-> config:


{
	test: /\.html$/,
	use: [{
		loader:'html-css-scope-loader',
		options: {
			minimize: true 		//  = css-loader minimize 
			extendsLoader:[  	// extends loader
				{
					loader: 'px2rem-loader',
					options: {
						remUnit: 100,
						remPrecision: 8
					}
				}
			]
		}
	}]
},

Html tempalte

<!-- 请注意-->
<!-- 由于参考vue-loader实现, 所以html:template !必须存在且只有一个根元素包裹-->
<!-- 并且相关自闭和元素,如img 必须按照<img xxx />方式闭合 不可以<img></img>方式   -->
<div class="watch-center-table fixed-height">
	<table class="account-ctrl-table">
		<tr>
			<th>品牌</th>
			<th>异常扣费</th>
			<th>被封账号</th>
		</tr>
		<tr>
			<!-- <td>自主账号</td> -->
			<td colspan="3" class="title-tr"><p><span>自主账号</span></p></td>
		</tr>
		<tr ng-repeat="item in selfAccountRiskControlData track by $index">
			<td>{{(item.type == 1 ? 21 : item.type) | bikeType}}</td>
			<td>{{item.exceptionCost}}</td>
			<td ng-class="{'redNotice': item.forbidden > 0}">{{item.forbidden}}</td>
		</tr>
		<tr>
			<td colspan="3" class="title-tr"><p><span>共享账号</span></p></td>
		</tr>
		<tr ng-repeat="item in shareAccountRiskControlData track by $index">
			<td>{{(item.type == 1 ? 21 : item.type) | bikeType}}</td>
			<td>{{item.exceptionCost}}</td>
			<td ng-class="{'redNotice': item.forbidden > 0}">{{item.forbidden}}</td>
		</tr>
	</table>
</div>


<!-- 支持@import 'xxxx' | require('xxx')两种方式-->
<!-- 支持scss,less,css 三种类型-->
<style>
	@import '../style/accountCtrl.scss';
	@import '../style/table.scss'
</style>