Giter Club home page Giter Club logo

symfony-webpack-boilerplate's Introduction

Symfony-Webpack boilerplate

This is the starting point for your next symfony+webpack project (based on webpack-bundle) Simply fork this repo and start working!

How to use

Before starting, make sure you have nodejs and composer installed

  • Install dependencies

    npm install
    composer install
    
  • Start developing (with hot reloading!)

    npm start
    
  • Compile for production

    npm run compile
    

Dependency management and structure

The entry script is located in app/Resources/assets/script/index.js. You can require your libraries and other external files as you normally would in a nodejs environment, and Webpack will take care of the rest. This setup is configured in such a way that we can simply use npm to manage our vendor dependencies (e.g. AngularJS, Bootstrap, jQuery, etc...)

Example usage

For example, to use jQuery in your project:

  • Fetch and save your dependency

    npm install --save jquery
  • Now you can use it in your project. In index.js file simply write

    var $ = require('jquery');
    
    // Now do your thing
    $("html").hide();

You can also use CSS libraries this way. For example, to use normalize.css:

  • Fetch and save

    npm install --save boostrap
  • Now require it as you would any other js library

    require('normalize.css'); // Now your page will include the CSS!

Customization

You can add loaders and customize webpack's behaviour by changing the file app/config/webpack.config.js By default, the configuration features:

  • SCSS/LESS preprocessing
  • JSX support
  • Hot reloading
  • Minification + Sourcemap generation

TODO

  • TypeScript support

symfony-webpack-boilerplate's People

Watchers

James Cloos avatar  avatar

Forkers

vinceblot

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.