Git Product home page Git Product logo

vuepress-offlinify's Introduction

VuePress offlinify

VuePress is a great tool for SPA containing set of articles like blog or documentation. It is a static site generator so a simple static content webserver is enough to serve it. But could it work locally via file:// links without a server at all? Apparently it doesn't, and I didn't find a way to make underlying webpack to make it. However it sounds possible if just use relative links and routing. Since it's not supported out of the box, here goes the dirty hacky way with rewriting output files :D

Disclaimer

Keep in mind the MIT license. This script is way too hacky to be called stable, you should consider all risks before using it for production.

Supported features

example-docs contains simple VuePress site I've checked the script on. You can check the offlinified result in the releases.

Feature \ VuePress version 1.5.1
Basic MD features ✔️
Basic theme ✔️
Sidebar and searchbar ✔️
External and internal links ✔️
Internal images ✔️
Favicon ✔️
Everything else

Usage

  1. Build your docs
  2. Copy-paste offlinify.js into root of your project and run it passing path to the docs dir like this:
    node offlinify.js example-docs
  3. Enjoy offlinified build at vuepress dist location

Limitations

Routing is supposed to work for pages placed in the root of site only like docs/example.html. I doubt it would work with nested pages like docs/reference/example.html.

Roadmap

I might check issues and PRs from time to time or fix nested pages or publish it as NPM package, I dunno. It depends on repo stars and demand.

vuepress-offlinify's People

Contributors

matheus-garbelini avatar thorny-thorny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vuepress-offlinify's Issues

Fallback to '/' does not work

Hi, thanks a lot for this project. However, it seems when using '/' on the sidebar, vuepress redirects to / which then breaks navigation.
Here an example of a configuration that is not working correctly for me.
To test this you need to create some dummy files (architecture.md and stacks.md)

const { description } = require('../../package')



module.exports = {
    /**
     * Ref:https://v1.vuepress.vuejs.org/config/#title
     */
    title: 'test',
    dest: './release/docs',
    base: '' || process.env['VUEPRESS_BASE_URL'],
    /**
     * Ref:https://v1.vuepress.vuejs.org/config/#description
     */
    description: description,

    /**
     * Extra tags to be injected to the page HTML `<head>`
     *
     * ref:https://v1.vuepress.vuejs.org/config/#head
     */
    head: [
        ['meta', { name: 'theme-color', content: '#3eaf7c' }],
        ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
        ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }]
    ],

    /**
     * Theme configuration, here is the default theme configuration for VuePress.
     *
     * ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html
     */
    themeConfig: {
        repo: '',
        repoLabel: 'Repository',
        editLinks: false,
        docsDir: 'docs',
        editLinkText: '',
        lastUpdated: true,
        nav: [{
                text: 'Getting Started',
                link: '/guide',
            },
            {
                text: 'Topics',
                items: [
                    { text: 'Architecture', link: '/architecture' },
                    { text: 'Protocol Stacks', link: '/stacks' },
                ]
            },
            {
                text: 'GreyHound',
                link: '/old_greyhound/index.html',
                target:'_blank'
            },
        ],
        sidebar: {
            '/': [{
                title: 'Topics',
                initialOpenGroupIndex: 0,
                sidebarDepth: 1,
                collapsable: false,
                children: [
                    '', /* index.md */
                    'guide',
                    'architecture',
                ]
            }],
        }
    },

    /**
     * Apply plugins,ref:https://v1.vuepress.vuejs.org/plugin/
     */
    plugins: [
        '@vuepress/plugin-back-to-top',
        '@vuepress/plugin-medium-zoom',
    ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.