Git Product home page Git Product logo

uibtabheading-dynamic-class's Introduction

Frontend Bootstrap

Kickoff for web applications.

Main Tools

First steps

Installing node

Get the latest version of node from the official website or using nvm Nvm approach is preferred. Also, you may find this tool useful to automate version changing between projects.

Getting the dev dependencies

Run npm install from rootpath of the project.

Bower and gulp. The right way

In the following step you will need to use bower, and during the project development you will probably use gulp every day, so let's use them in the right way. A very popular way of getting these packages is simply tell npm to install them globally using the -g flag. That's needless as gulp and bower are already in this project dependencies. A big problem can have place if the version of the packages that were installed globally do not match the versions that this project require. The right way to execute these tools is using the binaries in the node_modules folder, that is node_modules/.bin/. To execute bower just use the following ./node_modules/.bin/bower. Same for gulp. Adding an alias for these tools is highly recommended. Like the following:

alias gulp='node_modules/.bin/gulp'
alias bower='node_modules/.bin/bower'

Getting the project dependencies

The actual dependencies that will be used to develop the app are managed using bower. You can easily get them with the following command

bower install

You may be asking: why don't we simply get these packages using npm? Here are some articles I suggest reading about bower:

Gulp

To start your app run gulp in the rootpath of the project. Then access your app at localhost:port. The port is logged in the console where you ran gulp. Take a look at GULP_TASKS.md for a detailed explanation of the gulp tasks.

Development

Environments

By default, the environment will be development, but you can easily change it using the env param in your gulp tasks: gulp build --env production

SCSS

When creating SCSS files you don't need to import other files inside yours to use properties from them. There's a specific file called application.scss where every SCSS file should be imported in the desired priority order. This works just like the stylesheet elements in the head of an html, when repeated rules are present the rule that was imported last will override the other.

Vendors

To add a vendor simply install and save it using bower, then add the path of the source files, relative to the bower_components folder, to vendorJs.js or vendorCss.js depending on what you are adding. i.e: Adding jquery

bower install --save jquery

This will generate the jquery folder inside bower_components. Then, add the source file of jquery to vendorJs.js. It should look like this:

module.exports = [
  'jquery/dist/jquery.js',
];

Testing

Unit testing

We combine the power of Karma and Jasmine frameworks to develop our unit testing. You can find the configuration files in the test/unit folder and you can find the tests inside the test/unit/specs folder. To run these specs execute the following:

npm run karma
End to end tests

We combine the power of Protractor and Jasmine frameworks to develop our end to end tests. You can find the configuration files in the test/e2e folder and you can find the tests inside the test/e2e/specs folder.

The first time you are running the tests, you probably need to update webdriver. Use the following

./node_modules/.bin/webdriver-manager update

To run these specs against staging, execute the following:

npm run protractor

To run these specs against your development environment, execute the following:

npm run protractor-local

Maintenance

If your app will be down for a period of time, you can set up a maintenance page during the downtime. gulp build:maintenance will move the contents of src/maintenance to the build folder, then you only need to deploy that. If you want to customize the maintenance page, just change the contents of the src/maintenance folder.

Image compression

If you want to reduce your assets weight so that the build is ligther, you can turn on image compression option. To make this possible, set imageCompression variable as true in gulp/config.js file.

Webp Compression

This is accomplished using the (webp)[https://developers.google.com/speed/webp/?hl=en] image format.

Things to take into account:

  • If your assets include .png files, make sure libpng library is already installed.
  • If your assets include .jpeg files, make sure libjpeg library is already installed.

If any of these were not installed before you will need reinstall the webp conversion tool:

npm remove gulp-webp

Now, install the missing libraries.

Finally, reinstall gulp-webp with the following command:

npm install

Remember that you now have to reference your assets with .webp extension.

Errors

Rollbar is the tool we use to track errors. To set it up in the project follow these instructions:

  • Install rollbar.js
bower install rollbar --save
  • Add the rollbar snippet to vendorJs file
'rollbar/dist/rollbar.snippet.js'
  • Add the rollbar credentials in each secrets file in the config folder at the root of the project.

  • Add the _rollbarConfig configuration to the head of src/index.jade

  script.
    _rollbarConfig = {
      accessToken: '<!-- @echo ROLLBAR_ACCESS_TOKEN -->',
      captureUncaught: true,
      payload: {
        environment: '<!-- @echo environment -->'
      }
    };

Rollbar is now monitoring your page for all unhandled exceptions and is available via the global window.Rollbar object. Any further information can be found in the tracking tool repository

Deploy

S3

In order to deploy you must first create config/aws.js file with the credentials of the Amazon S3 bucket for each environment. The file needs to have to follow the format specified in config/aws.js.example

Then just run gulp s3 --env <environment name> with your desired env as parameter.

Finally, you need to add a custom routing rule so that s3 handles the 404 (or 403 depending or the bucket policy) to the s3 properties. In the Static Website Hosting panel, check the Enable website hosting option and complete the form with the following:

Index document: index.html

And add this redirect rule (Depending on the bucket policy the error code to handle can be either 404 or 403)

<RoutingRules>
    <RoutingRule>
        <Condition>
            <HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
        </Condition>
        <Redirect>
            <ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>
        </Redirect>
    </RoutingRule>
</RoutingRules>

Heroku

Pushing the desired branch to heroku should be enough.

Troubleshooting

npm permissions

If you are struggling with permission problems when using npm, you can try the following commands to avoid using sudo every time you have this troubles.

sudo chown -R $USER ~/.npm
sudo chown -R $USER .

S3 deploy

NOTE: You must have the corrects AIM permissions, if not, amazon will report an Access Denied error

gulp watch

If having problems with gulp watch, run echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p. This solution was found here.

Google Analytics

In order to monitor your page by google analytics set GOOGLE_ANALYTICS_TRACK_ID with the tracking id in each secrets file in the config folder at the root of the project.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

This project is maintained by Sebastian Balay and it was written by Wolox.

Wolox

License

frontend-bootstrap is available under the MIT license.

Copyright (c) 2015 Sebastián Balay <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

uibtabheading-dynamic-class's People

Contributors

dinuuu avatar jisevilla avatar mishuagopian avatar sbalay avatar skolz avatar

Watchers

 avatar

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.