CKSource Samples Framework

1.0.1 · abandoned · verified Sun Apr 19

The CKSource Samples Framework is a utility package designed to provide a foundational set of LESS stylesheets and Grunt-based build configurations. It aims to create consistent demonstration projects and samples within the CKSource ecosystem, particularly for products like CKEditor. As of its latest version, 1.0.1, the framework primarily leverages older technologies for its build processes, including Grunt for task automation and LESS for CSS pre-processing. Its focus is on providing pre-configured styles and build scripts tailored for internal sample development rather than serving as a general-purpose frontend framework. The package has seen no updates in approximately six years, suggesting it is no longer actively maintained.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to configure a Gruntfile.js to compile LESS files, importing styles and variables from `cksource-samples-framework`.

/* Gruntfile.js - Example for integrating cksource-samples-framework */
const path = require('path');

module.exports = function(grunt) {
  // Ensure a 'src' directory with a 'style.less' for compilation exists
  grunt.file.mkdir('src');
  grunt.file.write('src/style.less', `
    // Import core framework styles. Adjust path if necessary.
    @import (reference) "~cksource-samples-framework/less/base.less";
    @import (reference) "~cksource-samples-framework/less/variables.less";

    body {
      font-family: @cksource-font-family; // Using a variable from the framework
      background-color: @cksource-color-background;
      color: @cksource-color-text;
    }

    h1 {
      color: @cksource-color-primary;
    }
  `);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    less: {
      development: {
        options: {
          // Point to the framework's LESS files in node_modules
          paths: [path.join(__dirname, 'node_modules', 'cksource-samples-framework', 'less')],
          strictMath: true,
          syncImport: true
        },
        files: {
          'dist/style.css': 'src/style.less'
        }
      }
    },
    clean: {
      dist: ['dist']
    }
  });

  // Load the Grunt plugins required for the build
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-clean');

  // Register tasks to build the CSS
  grunt.registerTask('build', ['clean:dist', 'less:development']);
  grunt.registerTask('default', ['build']);

  console.log("\nTo run this example, ensure you have a package.json with the following devDependencies and run 'npm install' then 'grunt':");
  console.log(`
    {
      "name": "my-cksource-less-project",
      "version": "1.0.0",
      "devDependencies": {
        "cksource-samples-framework": "^1.0.1",
        "grunt": "^1.0.0",
        "grunt-cli": "^1.0.0",
        "grunt-contrib-less": "^2.0.0",
        "less": "^4.0.0"
      }
    }
  `);
  console.log("After running 'grunt', compiled CSS will be in 'dist/style.css'.");
};

view raw JSON →