• Stars
    star
    167
  • Rank 226,635 (Top 5 %)
  • Language
    JavaScript
  • Created almost 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Webpack Starter for Angular 1.5
https://travis-ci.org/kitconcept/webpack-starter-angular.svg?branch=master

Webpack Starter Angular

Stack

Requirements

ToDo:

Done:

Planed:

  • ES7 Decorators (@Component())
  • Typescript?

Prerequisits

Install a few dependencies globally:

$ npm install -g babel
$ npm install -g webpack
$ npm install -g webpack-dev-server
$ npm install -g eslint

Development

Create a JS bundle with Webpack:

$ npm run build

Start the Webpack development server on 'localhost:3000':

$ npm run start

Run tests:

$ npm run test

Linting:

$ npm run lint

HTML Webpack Plugin

Installation:

$ npm install html-webpack-plugin --save-dev

webpack.config.js:

var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  ...
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Website Starter',
      template: 'src/index.html',
      minify: {
        collapseWhitespace: true,
        removeComments: true,
        removeRedundantAttributes: true,
        removeScriptTypeAttributes: true,
        removeStyleLinkTypeAttributes: true
      }
    })
  ],
}

ES 6 Imports

Default import:

import localName from 'src/my_lib';

Namespace import: imports the module as an object (with one property per named export):

import * as my_lib from 'src/my_lib';

Named imports:

import { name1, name2 } from 'src/my_lib';

Renaming named imports:

// Renaming: import `name1` as `localName1`
import { name1 as localName1, name2 } from 'src/my_lib';
Empty import: only loads the module, doesnโ€™t import anything. The first such import in a program executes the body of the module.
import 'src/my_lib';

Source: http://exploringjs.com/es6/ch_modules.html

Imports for broken modules:

require('script!objectpath/lib/ObjectPath');

Source: https://webpack.github.io/docs/shimming-modules.html

SASS Loader

Installation:

$ npm install sass-loader --save-dev

Webpack Configuration (webpack.config.js):

module.exports = {
  ...
  module: {
    loaders: [
      ...
      { test: /\.scss$/, loaders: ["style", "css?sourceMap", "sass?sourceMap"]},
    ]
  },
  devtool: 'source-map'
}

Javascript:

import Styles from './styles.scss';

SASS (styles.scss):

body {
    padding-top: 80px;
}

Jade Loader

Installation:

$ npm install jade-loader --save-dev

Webpack Configuration (webpack.config.js):

module.exports = {
  ...
  module: {
    loaders: [
      ...
      { test: /\.jade$/, loader: 'jade-loader' },
    ]
  }
}

Javascript:

import template from './hero.jade';

Jade (hero.jade):

div.jumbotron
  h1 Angular, ES6, Webpack Starter!
  h3 You can find my template inside {{ vm.name }}.html

Angular Schema Form

Installation:

$ npm install angular-schema-form --save
$ npm install objectpath --save
$ npm install tv4 --save
$ npm install angular-sanitize --save

Javascript:

import 'angular-sanitize';
require('script!tv4/tv4.js');
require('script!objectpath/lib/ObjectPath');
require('script!angular-schema-form/dist/schema-form');
require('script!angular-schema-form/dist/bootstrap-decorator');

let formsModule = angular.module('forms', [
  uiRouter,
  'schemaForm'
])

...

Controller:

class FormsController {
  constructor() {
    this.name = 'Contact Us';
    this.model = {};
    this.schema = {
      type: 'object',
      properties: {
        name: { type: 'string', minLength: 2, title: 'Name', description: 'Name or alias' },
        title: {
          type: 'string',
          enum: ['dr','jr','sir','mrs','mr','NaN','dj']
        }
      },
      'required': [
        'name'
      ]
    };
    this.form = [
      '*',
      {
        type: 'submit',
        title: 'Save'
      }
    ];
  }
}

export default FormsController;

Service

...

Travis CI

  • Enable Travis for repository

.travis.yml:

language: node_js
node_js:
- 4.2.1
cache:
  directories:
    - node_modules
before_install:
  - export CHROME_BIN=chromium-browser
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
install:
- npm install -g babel
- npm install -g webpack
- npm install -g webpack-dev-server
- npm install -g eslint
- npm install
script:
- npm run test
notifications:
  email:
  - [email protected]

webpack.config.js:

...

ESLint

Installation:

$ npm install eslint -g

Sublime Text 3 Installation:

https://github.com/roadhump/SublimeLinter-eslint

Sources

More Repositories

1

jenkins-pipeline-examples

Jenkins Pipeline Examples (by kitconcept)
Shell
206
star
2

robotframework-djangolibrary

A Robot Framework library for Django.
Python
38
star
3

docker-stack-deploy

GitHub Action and Docker image used to deploy a Docker stack on a Docker Swarm
Shell
11
star
4

volto-light-theme

JavaScript
11
star
5

tutorial-django-react

JavaScript
7
star
6

robotframework-webpack

A Robot Framework library for Webpack
JavaScript
5
star
7

volto-blocks-grid

Sophisticated Page Layouts for Plone 6 (Volto)
JavaScript
5
star
8

buildout.zrs

Python
4
star
9

volto-form-builder

An interactive form builder for Volto, that allows editors to assemble forms via drag and drop.
JavaScript
4
star
10

volto-dsgvo-banner

JavaScript
3
star
11

volto-button-block

JavaScript
2
star
12

volto-heading-block

JavaScript
2
star
13

kitconcept.timeline

Plone Add-on to display a timeline
Python
2
star
14

plone.restapi-react-tutorial

JavaScript
2
star
15

kitconcept.voltodemo

Python
2
star
16

volto-custom

kitconcept's Volto latest customizations that didn't make into the core yet (or never will)
JavaScript
2
star
17

react-barcamp.de

JavaScript
2
star
18

kitconcept.plonepip

Dockerfile
2
star
19

pytest-solr

Solr fixtures for Pytest
Python
2
star
20

angular-medium-editor

Angular component for medium editor
JavaScript
2
star
21

kitconcept.api

A facade enhancing the already amazing plone.api
Python
2
star
22

pas.plugins.memberpropertytogroup

Plone PAS plugin to create virtual groups based on member properties.
Python
2
star
23

kitconcept.glossary

Glossary Add-on for the Plone CMS
JavaScript
2
star
24

ansible-role-jenkins

Ansible role to set up a Jenkins server
RobotFramework
2
star
25

kitconcept.contentcreator

Create content in a Plone site via JSON files
Python
2
star
26

cluster-purger

Purge multiple instances of Varnish inside a cluster
Python
1
star
27

volto-separator-block

JavaScript
1
star
28

volto-slider-block

Add Slider to a Plone (Volto) page.
JavaScript
1
star
29

volto-image-block

JavaScript
1
star
30

volto-highlight-block

JavaScript
1
star
31

volto-theme-twenty-twenty-one

JavaScript
1
star
32

kitconcept.volto

Backend configuration for Volto
Python
1
star
33

kitconcept.voltolighttheme

Example content for @kitconcept/volto-light-theme
Python
1
star
34

pytest-jenkins

Pytest fixture for Jenkins CI
Python
1
star
35

volto-solr

JavaScript
1
star
36

kitconcept.solr

Python
1
star
37

webpack-starter-angular2

Webpack Starter for Angular 2
TypeScript
1
star
38

kitconcept.seo

SEO enhancements for the Plone Content Management System (Volto only)
Python
1
star
39

volto-quote-block

JavaScript
1
star
40

robotframework-jwt

A Robot Framework library for JWT authentication
Python
1
star
41

volto-introduction-block

JavaScript
1
star
42

kitconcept.recipe.solr

Buildout recipe for Solr
Python
1
star
43

buildout

Basic Buildout setup with the kitconcept best practices.
VCL
1
star
44

volto-export

Volto add-on for exporting content in the fashion of kitconcept.contentcreator
JavaScript
1
star
45

volto-carousel-block

JavaScript
1
star
46

draft-js-medium

Medium-like rich text editor build on Draft.js
JavaScript
1
star
47

volto-social-blocks

Social Blocks support for Volto
JavaScript
1
star