Giter Site home page Giter Site logo

LVL99

GitHub package version: v1.4.6 Package dependencies by David MIT License Tested with Jest JavaScript Style Guide

My own personal frontend framework. Primarily uses jQuery, mildly inspired by Bootstrap and Ember.js and also has nothing to do with React. I also use it as a self-learning and development exercise experiment.

  • JavaScript is written in Node.js compatible ES6
  • I use StandardJS for coding style
  • I like how simple LESS is; I dislike how bloated SCSS is

Install

Include the lvl99 npm package in your npm project:

  npm install --save-dev lvl99

Use within JavaScript

ES6

Import the lvl99 module in your JavaScript:

  const lvl99 = require('lvl99')

You can also import single files if you don't want the whole JS framework:

  // Require whatever part of the framework you desire
  // Breakpoints needs to be initialised with defined sizes
  import Breakpoints from 'lvl99/es6/tools/breakpoints'
  const breakpoints = Breakpoints({
    'desktop': [1024, 99999],
    'tablet':  [600, 1024],
    'mobile':  [0, 600]
  })

Note: ES6 files have the .es6 extension to enable you to target these files using a transpiler like Babel.

Note: I've had some issues with transpiling from a node_modules folder. Ensure to put /node_modules\/lvl99\/es6\// in your babel-loader module rules and also include the babel-plugin-add-module-exports to your project and within your .babelrc.

Note: The ES6 files use the import/export method for modules, not require (CommonJS). Use the ES5 files if you want to use CommonJS like functionality.

ES5

If you are using ES5 JavaScript (aka, you're not transpiling, or you don't want to transpile) you can reference the same files within the es5 folder:

  // Require the whole LVL99 library
  var lvl99 = require('lvl99/es5')
  
  // Require a single file
  var Breakpoints = require('lvl99/es5/tools/breakpoints')({
    'desktop': [1024, 99999],
    'tablet':  [600, 1024],
    'mobile':  [0, 600]
  })

Note: These files are pre-transpiled from the ES6 ones for your convenience. ES5 files will have the .js extension.

HTML

If you want to include the whole framework outside of your build/bundle, then you can use the prebuilt dist/lvl99.js version (you'll need to copy it somewhere on your server to reference it). It should then be available as the global variable lvl99.

Note: The dist/lvl99.js version does not come with jQuery bundled, so please ensure it is included in your app somewhere before you load the lvl99.js file.

  <script type="text/javascript" src="jquery.min.js"></script>
  <script type="text/javascript" src="/js/lvl99.js"></script>
  <script type="text/javascript">
    console.log(lvl99)
  </script>

Use within LESS

Import the lvl99.less file in your LESS:

  @import 'path/to/node_modules/lvl99/less/lvl99.less';

You can also require/import single files if you don't want the whole LESS framework:

  // Import all the mixins
  @import 'path/to/node_modules/lvl99/less/mixins.less';
  
  // Or you can import each mixin file that you want
  @import 'path/to/node_modules/lvl99/less/mixins/inline-svg-code.less';

Architecture

@TODO!

Folder structure

  # Javascript (ES5 or ES6 flavours available)
  {es5,es6}/
    core/
      app.{js,es6}            # The app class 
      component.{js,es6}      # The component class that all other components inherit
      entity.{js,es6}         # The base entity class that all other classes inherit from
      index.{js,es6}          # All core modules in one
    components/
      accordion.{js,es6}
      index.{js,es6}          # All component modules in one
      modal.{js,es6}
      spinner.{js,es6} 
      toggleable.{js,es6}
    tools/
      breakpoints.{js,es6}    # Test for breakpoints in JS
      form-state.{js,es6}     # Enable saving form data to browser storage 
      index.{js,es6}          # All tools modules in one
      queue.{js,es6}          # Basic debounce queue for actions
      trackevent.{js,es6}     # Cache GA event tracking until GA object loaded
      smooth-scroll.{js,es6}  # Enable smooth scrolling when clicking anchor links
      storage.{js,es6}        # Convenience wrapper when using local/session storage
    utils/
      index.{js,es6}          # All utils modules in one
      inheritance.{js,es6}    # Some inheritance functions
      parse.{js,es6}          # Some parsing functions like type coercion, etc.
      super.{js,es6}          # Ember implementation of super behaviour
    common.{js,es6}           # Basic common used dependencies and variables
    index.{js,es6}            # All modules in one
    
  # LESS
  less/
    components/               # Component mixins
      accordion.less 
      modal.less
      spinner.less
      toggleable.less
    mixins/                   # Generic mixins
      align.less              # Margin, text, float alignment
      clearfix.less
      flex.less               # Some flex bits like columns, grid, alignment, etc.
      gradients.less
      grid.less               # Scaffolding
      inline-svg-code.less    # Quick way to embed SVG code directly in CSS
      inputs.less             # Form inputs like custom checkbox, radio, switch
      lists.less
      overflow.less
      position.less         
      responsive.less         # Size images to max width/height, plus show/hide elements based on breakpoints
      screen-reader.less
      spacing.less            # Remove top/bottom spacing within elements
    components.less           # All components in one
    lvl99.less                # All modules in one
    mixins.less               # All mixins in one

Dependencies

  • jQuery: Browser events, cross-browser implementations, etc.
  • object-path: Good for working with deep-nested objects
  • lodash.merge: Deep object extend
  • uuid: Unique ID generation

Dev Dependencies

  • Jest: Unit testing
  • Babel: Transpile ES6 to ES5
  • Webpack: Create lvl99.js distribution
  • Gulp: Task runner

TODO

  • Complete the README
  • Write more unit tests
  • Write more documentation throughout source
  • Create minified version of dist/lvl99.js

Contribute

What? Really? Are you sure? Aren't there other frameworks more worth your time?

MIT

Matt Scheurich's Projects

acf icon acf

Advanced Custom Fields

babel icon babel

🐠 Babel is a compiler for writing next generation JavaScript.

barbell icon barbell

Easily benchmark your JS code's performance via CLI using similar (but different) interface to Jest.

blockpress icon blockpress

Define and build custom content layouts with reusable blocks for your ACF-powered WordPress website

cli icon cli

Build apps, themes, and hydrogen storefronts for Shopify

code icon code

A bunch of old jQuery plugins and projects

compass icon compass

Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.

dayjs icon dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API

foundation-sites icon foundation-sites

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

greensock-js icon greensock-js

Public repository for GreenSock's JavaScript libraries like GSAP. See http://www.greensock.com

hepburn icon hepburn

Node.js module for converting Japanese Hiragana and Katakana script to, and from, Romaji using Hepburn romanisation

i18next icon i18next

i18next: learn once - translate everywhere

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.