geonorge-shared-partials

1.0.0 • Public • Published

Geonorge.SharedPartials

NPM version

Contains frontend for header used on Geonorge.no, including menu and search.

Prerequisites

npm, gulp

Install

$ npm install geonorge-shared-partials

Create the following gulpfile.js in the root of your project

var nodeUrl = "./node_modules/geonorge-shared-partials/",
gulp = require("gulp"),
bundleTask = require(nodeUrl + "gulp-tasks/bundle")(gulp),
config = {
  url: nodeUrl + "bundle.config.js",
  distFolder: "./dist"
};

gulp.task("default", function(){bundleTask(config)});

Basic Usage

Build js and css

$ gulp

Add stylesheets:

<link rel="stylesheet" href="/dist/vendor.css" />
<link rel="stylesheet" href="/dist/main.css" />

Use the html files in your root layout

// C# example
@Html.Raw(File.ReadAllText(Server.MapPath("~/dist/partials/Header.html")))

Include javascripts:

<script type="text/javascript" src="/dist/vendor.js" ></script>
<script type="text/javascript" src="/dist/main.js" ></script>

and include this js somewhere on your site

var applicationEnvironment = "local"; // "prod", "test", "dev" or "local" 
var orderItems = $.cookie('orderitems'); // Update "shopping cart" icon
if (orderItems && orderItems > 0) {
    $('.downloads__count').show();
    $('.downloads__count').text(orderItems);
}

Readme

Keywords

none

Package Sidebar

Install

npm i geonorge-shared-partials

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

3.66 MB

Total Files

35

Last publish

Collaborators

  • benjamindehli
  • dsreitan
  • dagolav
  • henningjensen