Skip to content

Commit

Permalink
Merge pull request #38 from pipocadigital/remove-front-end
Browse files Browse the repository at this point in the history
chore(tasks): remove front-end tasks
  • Loading branch information
alisonmonteiro authored Apr 25, 2018
2 parents d266ff0 + f20e82f commit 64424df
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 185 deletions.
144 changes: 37 additions & 107 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
<p align="center"><img src="http://upload-gifs.s3-sa-east-1.amazonaws.com/e3ea1527-cb01-4727-b3e3-2d52169b6e44_grao-de-milho.jpg"></p>

An initiative of [Pipoca Digital](http://www.pipocadigital.com.br) to help those people who want to create Static or WordPress websites easily.
An initiative of [Pipoca Digital](http://www.pipocadigital.com.br) to help those people who want to create WordPress websites easily.

## Table of contents

- [Highlights](#highlights)
- [Getting started](#getting-started)
- [Technologies](#technologies)
- [Structure](#structure)
- [Tasks](#tasks)
- [License](#license)

### Highlights
- Simple
- Free
- Fast
- Easy for begginers
- Uses cool stuff such as JS, Sass and Gulp

### Getting started
First of all, make sure you have installed the main dependencies:

Expand All @@ -35,36 +26,14 @@ $ cd my-project-folder
$ npm start --name "My cool project name"
```

We can create two types of projects. A Front-end (`front`) and a WordPress (`wp`) project.

#### Front-end Dev

```
$ npm run front:dev
```

1. Set the project format;
2. Generate your compiled files inside a folder called `www` and start your development server;
5. Open a new tab on your browser running a development server.

#### Front-end Deploy

```
$ npm run front:build
```

1. Set the project format;
2. Generate your compiled files inside a folder called `www`.

#### WordPress Dev
#### Dev

```
$ npm run wp:dev
```

1. Set the project format;
2. Download WordPress inside a folder called `wordpress/`
3. Copy your style.css, plugins, wp-configs.php files to the correct place.
3. Copy your files to the correct place.
4. Generate your theme based on your compiled files.
5. After all it will open a new tab on your browser running a development server.

Expand All @@ -74,16 +43,15 @@ To keep working on your WordPress project whithout donwload it everytime, just r
$ npm run serve
```

#### WordPress Deploy
#### Production

```
$ npm run wp:build
```

1. Set the project format;
2. Download WordPress inside a folder called `wordpress/`
3. Copy your style.css, plugins, wp-configs.php files to the correct place.
4. Generate your theme based on your compiled files.
1. Download WordPress inside a folder called `wordpress/`
2. Copy your files to the correct place.
3. Generate your theme based on your compiled files.


### Technologies
Expand All @@ -105,77 +73,39 @@ If everything from the Getting Started section goes well, you should have this:
├── bower.json
├── package.json
├── README.md
├── www
├── wordpress
└── src
├── js
│ ├── *.js
├── images
│ └── {.jpg, .png, .svg, .gif, .ico}
├── css
│ ├── components
│ │ └── _component-name.sass
│ ├── elements
│ │ └── _element-name.sass
│ ├── pages
│ │ └── page-name
│ │ └── *.sass
│ ├── settings
│ │ ├── _base.sass
│ │ ├── _colors.sass
│ │ ├── _measures.sass
│ │ └── _typography.sass
│ ├── tools
│ │ └── _mixins.sass
│ └── main.sass
├── 404.php
├── footer.php
├── functions.php
├── header.php
├── index.php
├── page.php
├── search.php
└── style.css
├── js
│ ├── *.js
├── images
│ └── {.jpg, .png, .svg, .gif, .ico}
├── css
│ ├── components
│ │ └── _component-name.sass
│ ├── elements
│ │ └── _element-name.sass
│ ├── pages
│ │ └── page-name
│ │ └── *.sass
│ ├── settings
│ │ ├── _base.sass
│ │ ├── _colors.sass
│ │ ├── _measures.sass
│ │ └── _typography.sass
│ ├── tools
│ │ └── _mixins.sass
│ └── main.sass
├── 404.php
├── footer.php
├── functions.php
├── header.php
├── index.php
├── page.php
├── search.php
└── style.css
```


### Gulp Tasks

If you're running gulp globally, so you can use all the tasks below:

##### Featured tasks...
1. `gulp`:
- Runs `gulp build`;
- Creates a watcher;
- Creates a webserver and open your brower;
2. `gulp init --name "Your project name"`: Renames the project;
3. `gulp wp`: Alias for `gulp wp-install`
4. `gulp build`: Run all the tasks below, except `wp-install and wp-build`.

##### More tasks...
1. `gulp clean`: Remove all the files from generated directory;
2. `gulp fonts`: Copy `fonts/` from source to generated directory;
3. `gulp images`: Copy `images/` from source to generated directory;
4. `gulp libs`: Get dependencies from brower, concat inside a only file and paste into the generated `scripts
` directory;
5. `gulp pages`: Copy all `.php` files from source to generated directory;
6. `gulp scripts`: Check the quality of all `.js` files, apply babel2015 presets and copy the `js/` files from source to generated directory;
7. `gulp styles`: Copy `styles/` from source to generated directory;
7. `gulp set-format --name "Project type"`: Set the project format
8. `gulp wp-install`:
- Checks if the project has a name;
- It also checks if WordPress is already installed;
- If you confirm, it installs the latest version of WordPress;
- Runs `gulp wp-build`;

9. `gulp wp-build`:
- Updates the DB configurations;
- Updates the authentication unique keys;
- Removes default themes from `wp-content/`;
- Copy files from `plugins/` to `wp-content/plugins/`;

*Generated directory* could be: `www/` or `wordpress/`


### License
Grão de Milho is distributed under the [MIT License](#)

Grão de Milho is distributed under the MIT License
47 changes: 13 additions & 34 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,26 @@ const gulpSync = require('gulp-sync')(gulp);
const requireDir = require('require-dir');
const packageJson = require('./package.json');

let defaultTasks = ['build', 'watch', 'connect-sync'];

if (packageJson.projectFormat === 'wordpress') {
defaultTasks.push('wp-pre-build');
}

const baseConfig = {
port: 3000,
phpPort: 3838,
localhost: 'localhost',
packageJson: packageJson,
format: packageJson.projectFormat ? packageJson.projectFormat : 'default',
compressed: true
};

const wpThemePath = 'wordpress/wp-content/themes/' + packageJson.name;
const paths = {
default: {
basePath: 'www/',
pagesDest: 'www/',
stylesDest: 'www/css',
fontsDest: 'www/fonts',
imagesDest: 'www/images',
scriptsDest: 'www/js'
},
wordpress: {
basePath: 'wordpress/',
pluginsWp: 'plugins/**/*.*',
styleWp: 'src/style.css',
configWp: 'wp-config.php',
pagesDest: wpThemePath,
fontsDest: wpThemePath + '/fonts',
imagesDest: wpThemePath + '/images',
stylesDest: wpThemePath + '/css',
scriptsDest: wpThemePath + '/js',
themesWp: 'wordpress/wp-content/themes/'
}
basePath: 'wordpress/',
pluginsWp: 'plugins/**/*.*',
styleWp: 'src/style.css',
configWp: 'wp-config.php',
pagesDest: wpThemePath,
fontsDest: wpThemePath + '/fonts',
imagesDest: wpThemePath + '/images',
stylesDest: wpThemePath + '/css',
scriptsDest: wpThemePath + '/js',
themesWp: 'wordpress/wp-content/themes/'
};

const devPaths = {
Expand All @@ -50,19 +33,15 @@ const devPaths = {
fonts: 'src/fonts/**/*.*'
};

gulp.paths = Object.assign(devPaths, paths[baseConfig.format]);
gulp.paths = Object.assign(devPaths, paths);
gulp.config = baseConfig;

// Gulp tasks
requireDir('tasks');

gulp.task('default', gulpSync.sync(defaultTasks));

gulp.task('wp', gulpSync.sync(['wp-install']));

gulp.task('build', gulpSync.sync([
'clean', 'styles', 'scripts', 'pages', 'images', 'fonts', 'libs'
]));
gulp.task('default', gulpSync.sync(['build', 'watch', 'connect-sync']));
gulp.task('build', gulpSync.sync(['clean', 'styles', 'scripts', 'pages', 'images', 'fonts', 'libs']));

gulp.task('watch', () => {
gulp.watch(gulp.paths.styles, ['styles']);
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"serve": "gulp",
"init": "gulp init --name",
"start": "npm install && bower install && npm run init",
"wp": "gulp set-format --name \"wordpress\" && gulp wp-install && gulp wp-pre-build && npm run wp:plugins",
"wp": "gulp wp-install && gulp wp-pre-build && npm run wp:plugins",
"wp:dev": "npm run wp && gulp",
"wp:build": "npm run wp && gulp build",
"wp:plugins": "cp -r ./plugins ./wordpress/wp-content",
"front": "gulp set-format --name \"default\"",
"front:dev": "npm run front && gulp",
"front:build": "npm run front && gulp build"
"wp:plugins": "cp -r ./plugins ./wordpress/wp-content"
},
"sasslintConfig": "sass-lint.yml",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tasks/browser-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ const browserSync = require('browser-sync');
gulp.task('browser-sync', function() {
const baseDir = gulp.paths.basePath;

browserSync({server: { baseDir }});
browserSync({server: {baseDir}});
});
38 changes: 0 additions & 38 deletions tasks/set-format.js

This file was deleted.

0 comments on commit 64424df

Please sign in to comment.