やりたいこと
Bootstrapで作った画面をTailwindで再構築してサクッと使えたらなーとおもってやってみる
使うファイル
Bootstrapのサンプルをつかいます
下記URLを開いて、ディベロッパーツールからbodyタグ内を抽出し
Bootstrapで使うもろもろcdnで入れた状態
https://getbootstrap.com/docs/4.4/examples/pricing/
一応コード
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
<body>
<a id="skippy" class="sr-only sr-only-focusable" href="#content">
<div class="container">
<span class="skiplink-text">Skip to main content</span>
</div>
</a>
<div
class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom shadow-sm">
<h5 class="my-0 mr-md-auto font-weight-normal">Company name</h5>
<nav class="my-2 my-md-0 mr-md-3">
<a class="p-2 text-dark" href="#">Features</a>
<a class="p-2 text-dark" href="#">Enterprise</a>
<a class="p-2 text-dark" href="#">Support</a>
<a class="p-2 text-dark" href="#">Pricing</a>
</nav>
<a class="btn btn-outline-primary" href="#">Sign up</a>
</div>
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Pricing</h1>
<p class="lead">Quickly build an effective pricing table for your potential customers with this Bootstrap
example. Its built with default Bootstrap components and utilities with little customization.</p>
</div>
<div class="container">
<div class="card-deck mb-3 text-center">
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Free</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$0 <small class="text-muted">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-outline-primary">Sign up for free</button>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Pro</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$15 <small class="text-muted">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>20 users included</li>
<li>10 GB of storage</li>
<li>Priority email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Get started</button>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Enterprise</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">$29 <small class="text-muted">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>30 users included</li>
<li>15 GB of storage</li>
<li>Phone and email support</li>
<li>Help center access</li>
</ul>
<button type="button" class="btn btn-lg btn-block btn-primary">Contact us</button>
</div>
</div>
</div>
<footer class="pt-4 my-md-5 pt-md-5 border-top">
<div class="row">
<div class="col-12 col-md">
<img class="mb-2" src="../../assets/brand/bootstrap-solid.svg" alt="" width="24" height="24">
<small class="d-block mb-3 text-muted">© 2017-2018</small>
</div>
<div class="col-6 col-md">
<h5>Features</h5>
<ul class="list-unstyled text-small">
<li><a class="text-muted" href="#">Cool stuff</a></li>
<li><a class="text-muted" href="#">Random feature</a></li>
<li><a class="text-muted" href="#">Team feature</a></li>
<li><a class="text-muted" href="#">Stuff for developers</a></li>
<li><a class="text-muted" href="#">Another one</a></li>
<li><a class="text-muted" href="#">Last time</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>Resources</h5>
<ul class="list-unstyled text-small">
<li><a class="text-muted" href="#">Resource</a></li>
<li><a class="text-muted" href="#">Resource name</a></li>
<li><a class="text-muted" href="#">Another resource</a></li>
<li><a class="text-muted" href="#">Final resource</a></li>
</ul>
</div>
<div class="col-6 col-md">
<h5>About</h5>
<ul class="list-unstyled text-small">
<li><a class="text-muted" href="#">Team</a></li>
<li><a class="text-muted" href="#">Locations</a></li>
<li><a class="text-muted" href="#">Privacy</a></li>
<li><a class="text-muted" href="#">Terms</a></li>
</ul>
</div>
</div>
</footer>
</div>
<script src="../../assets/js/vendor/holder.min.js"></script>
<script>
Holder.addTheme('thumb', {
bg: '#55595c',
fg: '#eceeef',
text: 'Thumbnail'
});
</script>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous">
</script>
</body>
</html>
インストール
composerかnpmでインストールします
composer global require awssat/tailwindo
OR
npm i -g tailwindo
インストールが終わるとtailwindo
コマンドが使えるので、tailwindo ファイル
で変換してやります
bladeにも使えて便利!
tailwindo resources/views/home.blade.php
tailwindo resources/views/home.html
コマンド終了後、変換したファイルと同階層に変換後のファイルが作られるので中身をパクリ、
確認します。
BootstrapのときいれたcdnのあれこれをTailwindのものにし表示してみる
一応コード
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
<body>
<a id="skippy" class=" " href="#content">
<div class="container mx-auto">
<span class="skiplink-text">Skip to main content</span>
</div>
</a>
<div class="flex flex-column md:flex-row align-center p-3 md:p x-4 mb-3 bg-white border-b shadow-sm">
<h5 class="my-0 md:mr-auto font-normal">Company name</h5>
<nav class="my-2 md:my-0 mr-md-3">
<a class="p-2 text-black" href="#">Features</a>
<a class="p-2 text-black" href="#">Enterprise</a>
<a class="p-2 text-black" href="#">Support</a>
<a class="p-2 text-black" href="#">Pricing</a>
</nav>
<a class="inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 px-4 rounded text-base leading-normal no-underline text-blue-dark border-blue bg-white hover:bg-blue-light hover:text-blue-darker"
href="#">Sign up</a>
</div>
<div class="pricing-header px-3 py-3 md:p t-5 pb-md-4 mx-auto text-center">
<h1 class="text-4xl">Pricing</h1>
<p class="text-lg font-light">Quickly build an effective pricing table for your potential customers with
this Bootstrap
example. Its built with default Bootstrap components and utilities with little customization.</p>
</div>
<div class="container mx-auto">
<div class="flex flex-col sm:flex-wrap sm:-ml-1 sm:-mr-1 mb-3 text-center">
<div
class="relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light mb-4 shadow-sm">
<div class="py-3 px-6 mb-0 bg-grey-lighter border-b-1 border-grey-light text-grey-darkest">
<h4 class="my-0 font-normal">Free</h4>
</div>
<div class="flex-auto p-6">
<h1 class="mb-3 pricing-card-title">$0 <text-sm class="text-grey">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>10 users included</li>
<li>2 GB of storage</li>
<li>Email support</li>
<li>Help center access</li>
</ul>
<button type="button"
class="inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 px-4 rounded text-base leading-normal no-underline py-3 px-4 text-xl leading-tight block w-full text-blue-dark border-blue bg-white hover:bg-blue-light hover:text-blue-darker">Sign
up for free</button>
</div>
</div>
<div
class="relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light mb-4 shadow-sm">
<div class="py-3 px-6 mb-0 bg-grey-lighter border-b-1 border-grey-light text-grey-darkest">
<h4 class="my-0 font-normal">Pro</h4>
</div>
<div class="flex-auto p-6">
<h1 class="mb-3 pricing-card-title">$15 <text-sm class="text-grey">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>20 users included</li>
<li>10 GB of storage</li>
<li>Priority email support</li>
<li>Help center access</li>
</ul>
<button type="button"
class="inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 px-4 rounded text-base leading-normal no-underline py-3 px-4 text-xl leading-tight block w-full text-blue-lightest bg-blue hover:bg-blue-light">Get
started</button>
</div>
</div>
<div
class="relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light mb-4 shadow-sm">
<div class="py-3 px-6 mb-0 bg-grey-lighter border-b-1 border-grey-light text-grey-darkest">
<h4 class="my-0 font-normal">Enterprise</h4>
</div>
<div class="flex-auto p-6">
<h1 class="mb-3 pricing-card-title">$29 <text-sm class="text-grey">/ mo</small></h1>
<ul class="list-unstyled mt-3 mb-4">
<li>30 users included</li>
<li>15 GB of storage</li>
<li>Phone and email support</li>
<li>Help center access</li>
</ul>
<button type="button"
class="inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 px-4 rounded text-base leading-normal no-underline py-3 px-4 text-xl leading-tight block w-full text-blue-lightest bg-blue hover:bg-blue-light">Contact
us</button>
</div>
</div>
</div>
<footer class="pt-4 md:my-5 md:p t-5 border-t">
<div class="flex flex-wrap">
<div class="w-full md:flex-grow">
<img class="mb-2" src="../../assets/brand/bootstrap-solid.svg" alt="" width="24" height="24">
<small class="block mb-3 text-grey">© 2017-2018</small>
</div>
<div class="w-1/2 md:flex-grow">
<h5>Features</h5>
<ul class="list-unstyled text-small">
<li><a class="text-grey" href="#">Cool stuff</a></li>
<li><a class="text-grey" href="#">Random feature</a></li>
<li><a class="text-grey" href="#">Team feature</a></li>
<li><a class="text-grey" href="#">Stuff for developers</a></li>
<li><a class="text-grey" href="#">Another one</a></li>
<li><a class="text-grey" href="#">Last time</a></li>
</ul>
</div>
<div class="w-1/2 md:flex-grow">
<h5>Resources</h5>
<ul class="list-unstyled text-small">
<li><a class="text-grey" href="#">Resource</a></li>
<li><a class="text-grey" href="#">Resource name</a></li>
<li><a class="text-grey" href="#">Another resource</a></li>
<li><a class="text-grey" href="#">Final resource</a></li>
</ul>
</div>
<div class="w-1/2 md:flex-grow">
<h5>About</h5>
<ul class="list-unstyled text-small">
<li><a class="text-grey" href="#">Team</a></li>
<li><a class="text-grey" href="#">Locations</a></li>
<li><a class="text-grey" href="#">Privacy</a></li>
<li><a class="text-grey" href="#">Terms</a></li>
</ul>
</div>
</div>
</footer>
</div>
<script src="../../assets/js/vendor/holder.min.js"></script>
<script>
Holder.addTheme('thumb', {
bg: '#55595c',
fg: '#eceeef',
text: 'Thumbnail'
});
</script>
</body>
</html>
結論
あかんかった...
Bootstrap -> Tailwind -> Purgeでいい感じになればという妄想は消えました