Skip to content

Instantly share code, notes, and snippets.

@lazyTai
Created September 21, 2017 23:01
Show Gist options
  • Save lazyTai/0b0a88541cfe5db4bbb58ce4fca20ec3 to your computer and use it in GitHub Desktop.
Save lazyTai/0b0a88541cfe5db4bbb58ce4fca20ec3 to your computer and use it in GitHub Desktop.
cssString+template==>with todo cssString use in react
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/underscore.js/1.8.3/underscore-min.js"></script>
<script src="bundle.js"></script>
</head>
<body>
<script>
var str=`
div {
position: relative;
width:"{{width}}";
height:"{{height}}";
}`
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
};
var after=_.template(str)({width:"100px",height:"111px"})
console.log(after)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment