欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

详解在 Angular 项目中添加 clean-blog 模板

程序员文章站 2022-05-26 08:22:37
在 angular 项目中添加 clean-blog 模板 clean-blog 博客模板下载 或者在下面链接下载 解压并拷贝 解压下载的文件,将所...

在 angular 项目中添加 clean-blog 模板

clean-blog 博客模板下载


或者在下面链接下载

解压并拷贝

解压下载的文件,将所有文件拷贝到 assets/clean-blog 目录下

详解在 Angular 项目中添加 clean-blog 模板

拷贝代码

将 clean-blog 的 index.html 内容拷贝到 app.component.html

<!--the whole content below can be removed with the new code.-->

<!-- navigation -->
<nav class="navbar fixed-top navbar-toggleable-md navbar-light" id="mainnav">
 <div class="container">
  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
      data-target="#navbarresponsive" aria-controls="navbarresponsive" aria-expanded="false"
      aria-label="toggle navigation">
   menu <i class="fa fa-bars"></i>
  </button>
  <a class="navbar-brand" href="index.html">start bootstrap</a>
  <div class="collapse navbar-collapse" id="navbarresponsive">
   <ul class="navbar-nav ml-auto">
    <li class="nav-item">
     <a class="nav-link" href="index.html">home</a>
    </li>
    <li class="nav-item">
     <a class="nav-link" href="../assets/clean-blog/about.html">about</a>
    </li>
    <li class="nav-item">
     <a class="nav-link" href="../assets/clean-blog/post.html">sample post</a>
    </li>
    <li class="nav-item">
     <a class="nav-link" href="../assets/clean-blog/contact.html">contact</a>
    </li>
   </ul>
  </div>
 </div>
</nav>

<!-- page header -->
<header class="masthead" style="background-image: url('../assets/clean-blog/img/home-bg.jpg')">
 <div class="container">
  <div class="row">
   <div class="col-lg-8 offset-lg-2 col-md-10 offset-md-1">
    <div class="site-heading">
     <h1>clean blog</h1>
     <span class="subheading">a blog theme by start bootstrap</span>
    </div>
   </div>
  </div>
 </div>
</header>

<!-- main content -->
<div class="container">
 <div class="row">
  <div class="col-lg-8 offset-lg-2 col-md-10 offset-md-1">
   <div class="post-preview">
    <a href="../assets/clean-blog/post.html">
     <h2 class="post-title">
      man must explore, and this is exploration at its greatest
     </h2>
     <h3 class="post-subtitle">
      problems look mighty small from 150 miles up
     </h3>
    </a>
    <p class="post-meta">posted by <a href="#">start bootstrap</a> on september 24, 2017</p>
   </div>
   <hr>
   <div class="post-preview">
    <a href="../assets/clean-blog/post.html">
     <h2 class="post-title">
      i believe every human has a finite number of heartbeats. i don't intend to waste any of mine.
     </h2>
    </a>
    <p class="post-meta">posted by <a href="#">start bootstrap</a> on september 18, 2017</p>
   </div>
   <hr>
   <div class="post-preview">
    <a href="../assets/clean-blog/post.html">
     <h2 class="post-title">
      science has not yet mastered prophecy
     </h2>
     <h3 class="post-subtitle">
      we predict too much for the next year and yet far too little for the next ten.
     </h3>
    </a>
    <p class="post-meta">posted by <a href="#">start bootstrap</a> on august 24, 2017</p>
   </div>
   <hr>
   <div class="post-preview">
    <a href="../assets/clean-blog/post.html">
     <h2 class="post-title">
      failure is not an option
     </h2>
     <h3 class="post-subtitle">
      many say exploration is part of our destiny, but it's actually our duty to future generations.
     </h3>
    </a>
    <p class="post-meta">posted by <a href="#">start bootstrap</a> on july 8, 2017</p>
   </div>
   <hr>
   <!-- pager -->
   <div class="clearfix">
    <a class="btn btn-secondary float-right" href="#">older posts →</a>
   </div>
  </div>
 </div>
</div>

<hr>

<!-- footer -->
<footer>
 <div class="container">
  <div class="row">
   <div class="col-lg-8 offset-lg-2 col-md-10 offset-md-1">
    <ul class="list-inline text-center">
     <li class="list-inline-item">
      <a href="#">
       <span class="fa-stack fa-lg">
         <i class="fa fa-circle fa-stack-2x"></i>
         <i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
       </span>
      </a>
     </li>
     <li class="list-inline-item">
      <a href="#">
       <span class="fa-stack fa-lg">
         <i class="fa fa-circle fa-stack-2x"></i>
         <i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
       </span>
      </a>
     </li>
     <li class="list-inline-item">
      <a href="#">
       <span class="fa-stack fa-lg">
         <i class="fa fa-circle fa-stack-2x"></i>
         <i class="fa fa-github fa-stack-1x fa-inverse"></i>
       </span>
      </a>
     </li>
    </ul>
    <p class="copyright text-muted">copyright © your website 2017</p>
   </div>
  </div>
 </div>
</footer>

styles.css 添加代码

/* clean-blog */
@import "assets/clean-blog/vendor/font-awesome/css/font-awesome.min.css";
@import "https://fonts.googleapis.com/css?family=lora:400,700,400italic,700italic";
@import "https://fonts.googleapis.com/css?family=open+sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800";
@import "assets/clean-blog/css/clean-blog.min.css";

.navbar-toggler {
 z-index: 1;
}

@media (max-width: 576px) {
 nav > .container {
  width: 100%;
 }
}

index.html 添加 js 引用

<!-- clean-blog -->
<script src="assets/clean-blog/js/clean-blog.min.js"></script>

结果

详解在 Angular 项目中添加 clean-blog 模板

提示: 文中的配置只是把 clean-blog 给搭建在 angular4 的项目中,但是并没有大改其中的东西,比如链接等,现在还是一个静态的网页,后期才会添加自己的代码上去

示例代码

angular + clean-blog

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。