Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Add Gruntjs for development #154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.zip
*.vi
*~

# OS or Editor folders
*.espressostorage
*.thumb
*.DS_Store
*.esproj
.DS_Store
._*
Thumbs.db
.cache
.project
.settings
.tmproj
*.esproj
nbproject
*.sublime-project
*.sublime-workspace
.idea

# Komodo
*.komodoproject
.komodotools

# Folders to ignore
node_modules
build
165 changes: 165 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*!
* Aqua Page Builder's Gruntfile
* https://github.com/syamilmj/Aqua-Page-Builder
*/

module.exports = function (grunt) {

'use strict';

// Load all Grunt tasks
require( 'load-grunt-tasks' )( grunt );

// Project configuration.
grunt.initConfig({

pkg: grunt.file.readJSON('package.json'),

makepot: {
theme: {
options: {
cwd: '',
potFilename: 'aqpb.pot',
domainPath: '/languages',
type: 'wp-plugin',
exclude: [ 'node_modules/.*' ],
processPot: function( pot, options ) {
pot.headers['report-msgid-bugs-to'] = 'https://github.com/syamilmj/Aqua-Page-Builder/issues/new';
pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;';
pot.headers['last-translator'] = 'AQPB (https://github.com/syamilmj/Aqua-Page-Builder/)\n';
pot.headers['language-team'] = 'AQPB (https://github.com/syamilmj/Aqua-Page-Builder/)\n';
pot.headers['x-poedit-basepath'] = '..\n';
pot.headers['x-poedit-language'] = 'English\n';
pot.headers['x-poedit-country'] = 'UNITED STATES\n';
pot.headers['x-poedit-sourcecharset'] = 'utf-8\n';
pot.headers['x-poedit-searchpath-0'] = '.\n';
pot.headers['x-poedit-keywordslist'] = '__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n';
pot.headers['x-textdomain-support'] = 'yes\n';
return pot;
}
}
}
},

csscomb: {
style: {
options: {
config: 'csscomb.json'
},
plugins: {
'assets/stylesheets/aqpb-view.css': ['assets/stylesheets/aqpb-view.css'],
'assets/stylesheets/aqpb.css': ['assets/stylesheets/aqpb.css'],
'assets/stylesheets/aqpb_blocks.css': ['assets/stylesheets/aqpb_blocks.css'],
},
}
},

cssmin: {

style: {
expand: true,
cwd: 'assets/stylesheets/',
src: ['*.css', '!*.min.css'],
dest: 'assets/stylesheets/',
ext: '.min.css'
},

},

uglify: {

options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},

plugin: {
files: {
'assets/javascripts/aqpb-fields.min.js': 'assets/javascripts/aqpb-fields.js',
'assets/javascripts/aqpb-view.min.js': 'assets/javascripts/aqpb-view.js',
'assets/javascripts/aqpb.min.js': 'assets/javascripts/aqpb.js',
}
},

},

watch: {
css: {
files: [ 'assets/stylesheets/*.css', 'assets/javascripts/*.js' ],
tasks: [ 'csscomb', 'cssmin', 'uglify' ]
}
},

// Clean up build directory
clean: {
main: ['build/<%= pkg.name %>']
},

// Copy the theme into the build directory
copy: {
main: {
src: [
'**',
'!*.log',
'!csscomb.json',
'!node_modules/**',
'!build/**',
'!.git/**',
'!Gruntfile.js',
'!package.json',
'!.gitignore',
'!.gitmodules',
'!.tx/**',
'!**/Gruntfile.js',
'!**/package.json',
'!**/*~'
],
dest: 'build/<%= pkg.name %>/'
}
},

// Replace text
replace: {
Version: {
src: ['aqua-page-builder.php'],
overwrite: true,
replacements: [ {
from: /^.*Version:.*$/m,
to: ' * Version: <%= pkg.version %>'
} ]
}
},

// Compress build directory into <name>.zip and <name>.<version>.zip
compress: {
main: {
options: {
mode: 'zip',
archive: './build/<%= pkg.name %>.v<%= pkg.version %>.zip'
},
expand: true,
cwd: 'build/<%= pkg.name %>/',
src: ['**/*'],
dest: '<%= pkg.name %>/'
}
},

});



grunt.registerTask( 'grunt-contrib-clean' );
grunt.registerTask( 'grunt-contrib-compress' );
grunt.registerTask( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.registerTask( 'grunt-contrib-uglify' );
grunt.registerTask( 'grunt-contrib-watch' );
grunt.registerTask( 'grunt-csscomb' );
grunt.registerTask( 'grunt-text-replace' );
grunt.registerTask( 'grunt-wp-i18n' );
grunt.registerTask( 'load-grunt-tasks' );

grunt.registerTask( 'css', [ 'csscomb', 'cssmin' ] );

grunt.registerTask( 'build', [ 'clean', 'replace', 'copy', 'compress' ] );

};
11 changes: 8 additions & 3 deletions aqua-page-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Author: Syamil MJ
* Author URI: http://aquagraphite.com
* Domain Path: /languages/
* Text Domain: aqpb-l10n
* Text Domain: aqpb
*
*/

Expand Down Expand Up @@ -45,9 +45,14 @@ function aqpb_get_version() {
}

function aqpb_localisation() {
load_plugin_textdomain( 'aqpb-i10n', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
$domain = 'aqpb';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );

/* Load the translation of the plugin. */
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
add_action('init', 'aqpb_localisation');
add_action( 'plugins_loaded', 'aqpb_localisation' );

//required functions & classes
require_once(AQPB_PATH . 'functions/aqpb_config.php');
Expand Down
26 changes: 13 additions & 13 deletions blocks/aq-alert-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AQ_Alert_Block extends AQ_Block {
//set and create block
function __construct() {
$block_options = array(
'name' => __('Alerts', 'aqpb-l10n'),
'name' => __( 'Alerts', 'aqpb' ),
'size' => 'span6',
);

Expand All @@ -18,44 +18,44 @@ function __construct() {
function form($instance) {

$defaults = array(
'content' => '',
'type' => 'note',
'style' => ''
'content' => '',
'type' => 'note',
'style' => ''
);
$instance = wp_parse_args($instance, $defaults);
extract($instance);

$type_options = array(
'default' => 'Standard',
'info' => 'Info',
'note' => 'Notification',
'warn' => 'Warning',
'tips' => 'Tips'
'default' => __( 'Standard', 'aqpb' ),
'info' => __( 'Info', 'aqpb' ),
'note' => __( 'Notification', 'aqpb' ),
'warn' => __( 'Warning', 'aqpb' ),
'tips' => __( 'Tips', 'aqpb' )
);

?>

<p class="description">
<label for="<?php echo $this->get_field_id('title') ?>">
Title (optional)<br/>
<?php _e( 'Title (optional)', 'aqpb' );?><br/>
<?php echo aq_field_input('title', $block_id, $title) ?>
</label>
</p>
<p class="description">
<label for="<?php echo $this->get_field_id('content') ?>">
Alert Text (required)<br/>
<?php _e( 'Alert Text (required)', 'aqpb' );?><br/>
<?php echo aq_field_textarea('content', $block_id, $content) ?>
</label>
</p>
<p class="description half">
<label for="<?php echo $this->get_field_id('type') ?>">
Alert Type<br/>
<?php _e( 'Alert Type', 'aqpb' );?><br/>
<?php echo aq_field_select('type', $block_id, $type_options, $type) ?>
</label>
</p>
<p class="description half last">
<label for="<?php echo $this->get_field_id('style') ?>">
Additional inline css styling (optional)<br/>
<?php _e( 'Additional inline css styling (optional)', 'aqpb' );?><br/>
<?php echo aq_field_input('style', $block_id, $style) ?>
</label>
</p>
Expand Down
26 changes: 13 additions & 13 deletions blocks/aq-clear-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AQ_Clear_Block extends AQ_Block {
//set and create block
function __construct() {
$block_options = array(
'name' => __('Clear', 'aqpb-l10n'),
'name' => __( 'Clear', 'aqpb' ),
'size' => 'span12',
);

Expand All @@ -20,17 +20,17 @@ function __construct() {
function form($instance) {

$defaults = array(
'horizontal_line' => 'none',
'line_color' => '#353535',
'pattern' => '1',
'height' => ''
'horizontal_line' => 'none',
'line_color' => '#353535',
'pattern' => '1',
'height' => ''
);

$line_options = array(
'none' => 'None',
'single' => 'Single',
'double' => 'Double',
'image' => 'Use Image',
'none' => __( 'None', 'aqpb' ),
'single' => __( 'Single', 'aqpb' ),
'double' => __( 'Double', 'aqpb' ),
'image' => __( 'Use Image', 'aqpb' ),
);

$instance = wp_parse_args($instance, $defaults);
Expand All @@ -40,23 +40,23 @@ function form($instance) {

?>
<p class="description note">
<?php _e('Use this block to clear the floats between two or more separate blocks vertically.', 'aqpb-l10n') ?>
<?php _e( 'Use this block to clear the floats between two or more separate blocks vertically.', 'aqpb' ) ?>
</p>
<p class="description fourth">
<label for="<?php echo $this->get_field_id('line_color') ?>">
Pick a horizontal line<br/>
<?php _e( 'Pick a horizontal line', 'aqpb' );?><br/>
<?php echo aq_field_select('horizontal_line', $block_id, $line_options, $horizontal_line, $block_id); ?>
</label>
</p>
<div class="description fourth">
<label for="<?php echo $this->get_field_id('height') ?>">
Height (optional)<br/>
<?php _e( 'Height (optional)', 'aqpb' );?><br/>
<?php echo aq_field_input('height', $block_id, $height, 'min', 'number') ?> px
</label>
</div>
<div class="description half last">
<label for="<?php echo $this->get_field_id('line_color') ?>">
Pick a line color<br/>
<?php _e( 'Pick a line color', 'aqpb' );?><br/>
<?php echo aq_field_color_picker('line_color', $block_id, $line_color, $defaults['line_color']) ?>
</label>

Expand Down
6 changes: 3 additions & 3 deletions blocks/aq-column-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AQ_Column_Block extends AQ_Block {
function __construct() {

$block_options = array(
'name' => __('Column', 'aqpb-l10n'),
'name' => __('Column', 'aqpb'),
'size' => 'span6',
);

Expand Down Expand Up @@ -40,7 +40,7 @@ function before_form($instance) {

function form($instance) {
echo '<p class="empty-column">',
__('Drag block items into this column box', 'aqpb-l10n'),
__( 'Drag block items into this column box', 'aqpb' ),
'</p>';
echo '<ul class="blocks column-blocks cf"></ul>';
}
Expand All @@ -61,7 +61,7 @@ function form_callback($instance = array()) {
echo '<li id="template-block-'.$number.'" class="block block-container block-aq_column_block '.$size.'">',
'<div class="block-settings-column cf" id="block-settings-'.$number.'">',
'<p class="empty-column">',
__('Drag block items into this column box', 'aqpb-l10n'),
__('Drag block items into this column box', 'aqpb'),
'</p>',
'<ul class="blocks column-blocks cf">';

Expand Down
Loading